diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index ba7c1fe2af38..c33cab7cc47f 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -275,6 +275,7 @@ com.azure.spring:spring-cloud-azure-stream-binder-servicebus-core;7.4.0;7.5.0-be com.azure.spring:spring-cloud-azure-stream-binder-servicebus;7.4.0;7.5.0-beta.1 com.azure.spring:spring-cloud-azure-testcontainers;7.4.0;7.5.0-beta.1 com.azure:azure-spring-data-cosmos;7.4.0;7.5.0-beta.1 +com.azure:azure-iot-deviceregistry-softwareupdate;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager;2.63.0;2.64.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-appplatform;2.51.0;2.52.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-appservice;2.56.0;2.57.0-beta.1 diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/CHANGELOG.md b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/CHANGELOG.md new file mode 100644 index 000000000000..5aa2e8647fc4 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/CHANGELOG.md @@ -0,0 +1,16 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +- Azure DeviceRegistrySoftwareUpdateClient client library for Java. This package contains Microsoft Azure DeviceRegistrySoftwareUpdateClient client library. + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes +### Features Added + +- Initial release for the azure-iot-deviceregistry-softwareupdate Java SDK. diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/README.md b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/README.md new file mode 100644 index 000000000000..fffca3f5b387 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/README.md @@ -0,0 +1,78 @@ +# Azure DeviceRegistrySoftwareUpdateClient client library for Java + +Azure DeviceRegistrySoftwareUpdateClient client library for Java. + +This package contains Microsoft Azure DeviceRegistrySoftwareUpdateClient client library. + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] +- [Product documentation][product_documentation] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure:azure-iot-deviceregistry-softwareupdate;current}) +```xml + + com.azure + azure-iot-deviceregistry-softwareupdate + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Authentication + +[Azure Identity][azure_identity] package provides the default implementation for authenticating the client. + +## Key concepts + +## Examples + +```java com.azure.iot.deviceregistry.softwareupdate.readme +``` + +### Service API versions + +The client library targets the latest service API version by default. +The service client builder accepts an optional service API version parameter to specify which API version to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when initializing a service client via the service client builder. +This ensures that the client can communicate with services using the specified API version. + +When selecting an API version, it is important to verify that there are no breaking changes compared to the latest API version. +If there are significant differences, API calls may fail due to incompatibility. + +Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy. + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[product_documentation]: https://azure.microsoft.com/services/ +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/assets.json b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/assets.json new file mode 100644 index 000000000000..15933b7dd202 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/assets.json @@ -0,0 +1 @@ +{"AssetsRepo":"Azure/azure-sdk-assets","AssetsRepoPrefixPath":"java","TagPrefix":"java/deviceregistry/azure-iot-deviceregistry-softwareupdate","Tag":""} \ No newline at end of file diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/pom.xml b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/pom.xml new file mode 100644 index 000000000000..a39259b39dcc --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure + azure-iot-deviceregistry-softwareupdate + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for DeviceRegistrySoftwareUpdateClient + This package contains Microsoft Azure DeviceRegistrySoftwareUpdateClient client library. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + com.azure + azure-core + 1.59.0 + + + com.azure + azure-core-http-netty + 1.16.6 + + + com.azure + azure-core-test + 1.27.0-beta.17 + test + + + com.azure + azure-identity + 1.18.4 + test + + + diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceClassesAsyncClient.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceClassesAsyncClient.java new file mode 100644 index 000000000000..3f3c191f7c6d --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceClassesAsyncClient.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.iot.deviceregistry.softwareupdate.implementation.DeviceClassesImpl; +import com.azure.iot.deviceregistry.softwareupdate.models.DeviceClass; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DeviceRegistrySoftwareUpdateClient type. + */ +@ServiceClient(builder = DeviceRegistrySoftwareUpdateClientBuilder.class, isAsync = true) +public final class DeviceClassesAsyncClient { + @Generated + private final DeviceClassesImpl serviceClient; + + /** + * Initializes an instance of DeviceClassesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DeviceClassesAsyncClient(DeviceClassesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Gets a list of device classes. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @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 a list of device classes as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); + } + + /** + * Gets the properties of a device class. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param deviceClassId Device class identifier. + * @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 properties of a device class along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDeviceClassWithResponse(String deviceClassId, RequestOptions requestOptions) { + return this.serviceClient.getDeviceClassWithResponseAsync(deviceClassId, requestOptions); + } + + /** + * Deletes a device class. + * + * @param deviceClassId Device class identifier. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse(String deviceClassId, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(deviceClassId, requestOptions); + } + + /** + * Gets a list of device classes. + * + * @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 a list of device classes as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = list(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(DeviceClass.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Gets the properties of a device class. + * + * @param deviceClassId Device class identifier. + * @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 properties of a device class on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDeviceClass(String deviceClassId) { + // Generated convenience method for getDeviceClassWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDeviceClassWithResponse(deviceClassId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DeviceClass.class)); + } + + /** + * Deletes a device class. + * + * @param deviceClassId Device class identifier. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono delete(String deviceClassId) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteWithResponse(deviceClassId, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceClassesClient.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceClassesClient.java new file mode 100644 index 000000000000..24a73c58b10d --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceClassesClient.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.iot.deviceregistry.softwareupdate.implementation.DeviceClassesImpl; +import com.azure.iot.deviceregistry.softwareupdate.models.DeviceClass; + +/** + * Initializes a new instance of the synchronous DeviceRegistrySoftwareUpdateClient type. + */ +@ServiceClient(builder = DeviceRegistrySoftwareUpdateClientBuilder.class) +public final class DeviceClassesClient { + @Generated + private final DeviceClassesImpl serviceClient; + + /** + * Initializes an instance of DeviceClassesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DeviceClassesClient(DeviceClassesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Gets a list of device classes. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @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 a list of device classes as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); + } + + /** + * Gets the properties of a device class. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param deviceClassId Device class identifier. + * @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 properties of a device class along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDeviceClassWithResponse(String deviceClassId, RequestOptions requestOptions) { + return this.serviceClient.getDeviceClassWithResponse(deviceClassId, requestOptions); + } + + /** + * Deletes a device class. + * + * @param deviceClassId Device class identifier. + * @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 {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String deviceClassId, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponse(deviceClassId, requestOptions); + } + + /** + * Gets a list of device classes. + * + * @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 a list of device classes as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(DeviceClass.class)); + } + + /** + * Gets the properties of a device class. + * + * @param deviceClassId Device class identifier. + * @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 properties of a device class. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceClass getDeviceClass(String deviceClassId) { + // Generated convenience method for getDeviceClassWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDeviceClassWithResponse(deviceClassId, requestOptions).getValue().toObject(DeviceClass.class); + } + + /** + * Deletes a device class. + * + * @param deviceClassId Device class identifier. + * @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. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String deviceClassId) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteWithResponse(deviceClassId, requestOptions).getValue(); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateClientBuilder.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateClientBuilder.java new file mode 100644 index 000000000000..f496ee0ed9bd --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateClientBuilder.java @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.TokenCredentialTrait; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.iot.deviceregistry.softwareupdate.implementation.DeviceRegistrySoftwareUpdateClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the DeviceRegistrySoftwareUpdateClient type. + */ +@ServiceClientBuilder( + serviceClients = { + DeviceClassesClient.class, + SoftwareUpdateClient.class, + DeviceClassesAsyncClient.class, + SoftwareUpdateAsyncClient.class }) +public final class DeviceRegistrySoftwareUpdateClientBuilder implements + HttpTrait, ConfigurationTrait, + TokenCredentialTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final String[] DEFAULT_SCOPES = new String[] { "https://api.adu.microsoft.com/.default" }; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-iot-deviceregistry-softwareupdate.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the DeviceRegistrySoftwareUpdateClientBuilder. + */ + @Generated + public DeviceRegistrySoftwareUpdateClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeviceRegistrySoftwareUpdateClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeviceRegistrySoftwareUpdateClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeviceRegistrySoftwareUpdateClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeviceRegistrySoftwareUpdateClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeviceRegistrySoftwareUpdateClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeviceRegistrySoftwareUpdateClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeviceRegistrySoftwareUpdateClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + @Generated + private TokenCredential tokenCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeviceRegistrySoftwareUpdateClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeviceRegistrySoftwareUpdateClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private DeviceRegistrySoftwareUpdateServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the DeviceRegistrySoftwareUpdateClientBuilder. + */ + @Generated + public DeviceRegistrySoftwareUpdateClientBuilder + serviceVersion(DeviceRegistrySoftwareUpdateServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the DeviceRegistrySoftwareUpdateClientBuilder. + */ + @Generated + public DeviceRegistrySoftwareUpdateClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of DeviceRegistrySoftwareUpdateClientImpl with the provided parameters. + * + * @return an instance of DeviceRegistrySoftwareUpdateClientImpl. + */ + @Generated + private DeviceRegistrySoftwareUpdateClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + DeviceRegistrySoftwareUpdateServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : DeviceRegistrySoftwareUpdateServiceVersion.getLatest(); + DeviceRegistrySoftwareUpdateClientImpl client = new DeviceRegistrySoftwareUpdateClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of DeviceClassesAsyncClient class. + * + * @return an instance of DeviceClassesAsyncClient. + */ + @Generated + public DeviceClassesAsyncClient buildDeviceClassesAsyncClient() { + return new DeviceClassesAsyncClient(buildInnerClient().getDeviceClasses()); + } + + /** + * Builds an instance of SoftwareUpdateAsyncClient class. + * + * @return an instance of SoftwareUpdateAsyncClient. + */ + @Generated + public SoftwareUpdateAsyncClient buildSoftwareUpdateAsyncClient() { + return new SoftwareUpdateAsyncClient(buildInnerClient().getSoftwareUpdates()); + } + + /** + * Builds an instance of DeviceClassesClient class. + * + * @return an instance of DeviceClassesClient. + */ + @Generated + public DeviceClassesClient buildDeviceClassesClient() { + return new DeviceClassesClient(buildInnerClient().getDeviceClasses()); + } + + /** + * Builds an instance of SoftwareUpdateClient class. + * + * @return an instance of SoftwareUpdateClient. + */ + @Generated + public SoftwareUpdateClient buildSoftwareUpdateClient() { + return new SoftwareUpdateClient(buildInnerClient().getSoftwareUpdates()); + } + + private static final ClientLogger LOGGER = new ClientLogger(DeviceRegistrySoftwareUpdateClientBuilder.class); +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateServiceVersion.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateServiceVersion.java new file mode 100644 index 000000000000..e810235ba16b --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateServiceVersion.java @@ -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 com.azure.iot.deviceregistry.softwareupdate; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of DeviceRegistrySoftwareUpdateClient. + */ +public enum DeviceRegistrySoftwareUpdateServiceVersion implements ServiceVersion { + /** + * Enum value 2026-11-02-preview. + */ + V2026_11_02_PREVIEW("2026-11-02-preview"); + + private final String version; + + DeviceRegistrySoftwareUpdateServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link DeviceRegistrySoftwareUpdateServiceVersion}. + */ + public static DeviceRegistrySoftwareUpdateServiceVersion getLatest() { + return V2026_11_02_PREVIEW; + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/SoftwareUpdateAsyncClient.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/SoftwareUpdateAsyncClient.java new file mode 100644 index 000000000000..e60da18a7d84 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/SoftwareUpdateAsyncClient.java @@ -0,0 +1,1137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.iot.deviceregistry.softwareupdate.implementation.SoftwareUpdatesImpl; +import com.azure.iot.deviceregistry.softwareupdate.models.ImportUpdateRequest; +import com.azure.iot.deviceregistry.softwareupdate.models.Update; +import com.azure.iot.deviceregistry.softwareupdate.models.UpdateFile; +import com.azure.iot.deviceregistry.softwareupdate.models.UpdateOperation; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DeviceRegistrySoftwareUpdateClient type. + */ +@ServiceClient(builder = DeviceRegistrySoftwareUpdateClientBuilder.class, isAsync = true) +public final class SoftwareUpdateAsyncClient { + @Generated + private final SoftwareUpdatesImpl serviceClient; + + /** + * Initializes an instance of SoftwareUpdateAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SoftwareUpdateAsyncClient(SoftwareUpdatesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get a list of all updates that have been imported to Software Update for Device + * Registry. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
searchStringNoRequest updates matching a free-text search + * expression.
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all updates that have been imported to Software Update for Device + * Registry as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listUpdates(RequestOptions requestOptions) { + return this.serviceClient.listUpdatesAsync(requestOptions); + } + + /** + * Import new update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     importUpdateInput (Required): [
+     *          (Required){
+     *             importManifest (Required): {
+     *                 url: String (Required)
+     *                 sizeInBytes: long (Required)
+     *                 hashes (Required): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *             friendlyName: String (Optional)
+     *             files (Optional): [
+     *                  (Optional){
+     *                     fileName: String (Required)
+     *                     url: String (Required)
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     *     enableScan: Boolean (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param importUpdateRequest The update to be imported (see schema + * https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + * details). + * @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 {@link PollerFlux} for polling of update metadata. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginImportUpdate(BinaryData importUpdateRequest, + RequestOptions requestOptions) { + return this.serviceClient.beginImportUpdateAsync(importUpdateRequest, requestOptions); + } + + /** + * Get a specific update version. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a specific update version along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getUpdateWithResponse(String provider, String name, String version, + RequestOptions requestOptions) { + return this.serviceClient.getUpdateWithResponseAsync(provider, name, version, requestOptions); + } + + /** + * Delete a specific update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDeleteUpdate(String provider, String name, String version, + RequestOptions requestOptions) { + return this.serviceClient.beginDeleteUpdateAsync(provider, name, version, requestOptions); + } + + /** + * Get a list of all update providers that have been imported to Software Update for + * Device Registry. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @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 a list of all update providers that have been imported to Software Update for + * Device Registry as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listProviders(RequestOptions requestOptions) { + return this.serviceClient.listProvidersAsync(requestOptions); + } + + /** + * Get a list of all update names that match the specified provider. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @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 a list of all update names that match the specified provider as paginated response with + * {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listNames(String provider, RequestOptions requestOptions) { + return this.serviceClient.listNamesAsync(provider, requestOptions); + } + + /** + * Get a list of all update versions that match the specified provider and name. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @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 a list of all update versions that match the specified provider and name as paginated response with + * {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listVersions(String provider, String name, RequestOptions requestOptions) { + return this.serviceClient.listVersionsAsync(provider, name, requestOptions); + } + + /** + * Get a list of all update file identifiers for the specified version. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a list of all update file identifiers for the specified version as paginated response with + * {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listFiles(String provider, String name, String version, + RequestOptions requestOptions) { + return this.serviceClient.listFilesAsync(provider, name, version, requestOptions); + } + + /** + * Get a specific update file from the version. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     fileName: String (Required)
+     *     sizeInBytes: long (Required)
+     *     hashes (Required): {
+     *         String: String (Required)
+     *     }
+     *     mimeType: String (Optional)
+     *     scanResult: String (Optional)
+     *     scanDetails: String (Optional)
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     fileId: String (Required)
+     *     relatedFiles (Optional): [
+     *          (Optional){
+     *             fileName: String (Required)
+     *             sizeInBytes: long (Required)
+     *             hashes (Required): {
+     *                 String: String (Required)
+     *             }
+     *             mimeType: String (Optional)
+     *             scanResult: String (Optional)
+     *             scanDetails: String (Optional)
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     downloadHandler (Optional): {
+     *         id: String (Required)
+     *     }
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param fileId File identifier. + * @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 a specific update file from the version along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFileWithResponse(String provider, String name, String version, String fileId, + RequestOptions requestOptions) { + return this.serviceClient.getFileWithResponseAsync(provider, name, version, fileId, requestOptions); + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 + * days before auto-deleted. Delete operations are not returned by this API + * version. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter operations by status property. Only one + * specific filter is + * supported: "status eq 'NotStarted' or status eq 'Running'"
maxpagesizeIntegerNoSpecifies a non-negative integer n that limits the number + * of items returned + * from a collection. The service returns the number of available items up to but + * not greater than the specified value n.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all import update operations as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listOperationStatuses(RequestOptions requestOptions) { + return this.serviceClient.listOperationStatusesAsync(requestOptions); + } + + /** + * Retrieve operation status. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Headers

+ * + * + * + * + *
Response Headers
NameTypeDescription
Retry-AfterStringNumber of seconds to wait before checking the operation status + * again.
+ * + * @param operationId Operation identifier. + * @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 operation metadata along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationStatusWithResponse(String operationId, + RequestOptions requestOptions) { + return this.serviceClient.getOperationStatusWithResponseAsync(operationId, requestOptions); + } + + /** + * Get a list of all updates that have been imported to Software Update for Device + * Registry. + * + * @param search Request updates matching a free-text search expression. + * @param filter Optional to filter updates by isDeployable property. + * @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 a list of all updates that have been imported to Software Update for Device + * Registry as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listUpdates(String search, String filter) { + // Generated convenience method for listUpdates + RequestOptions requestOptions = new RequestOptions(); + if (search != null) { + requestOptions.addQueryParam("search", search, false); + } + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + PagedFlux pagedFluxResponse = listUpdates(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Update.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get a list of all updates that have been imported to Software Update for Device + * Registry. + * + * @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 a list of all updates that have been imported to Software Update for Device + * Registry as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listUpdates() { + // Generated convenience method for listUpdates + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listUpdates(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Update.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Import new update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param importUpdateRequest The update to be imported (see schema + * https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + * details). + * @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 {@link PollerFlux} for polling of update metadata. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginImportUpdate(ImportUpdateRequest importUpdateRequest) { + // Generated convenience method for beginImportUpdateWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginImportUpdateWithModelAsync(BinaryData.fromObject(importUpdateRequest), + requestOptions); + } + + /** + * Get a specific update version. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if + * the ETag on the server does not match this value. + * @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 a specific update version on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getUpdate(String provider, String name, String version, String ifNoneMatch) { + // Generated convenience method for getUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + return getUpdateWithResponse(provider, name, version, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Update.class)); + } + + /** + * Get a specific update version. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a specific update version on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getUpdate(String provider, String name, String version) { + // Generated convenience method for getUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getUpdateWithResponse(provider, name, version, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Update.class)); + } + + /** + * Delete a specific update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDeleteUpdate(String provider, String name, String version) { + // Generated convenience method for beginDeleteUpdateWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginDeleteUpdateWithModelAsync(provider, name, version, requestOptions); + } + + /** + * Get a list of all update providers that have been imported to Software Update for + * Device Registry. + * + * @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 a list of all update providers that have been imported to Software Update for + * Device Registry as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listProviders() { + // Generated convenience method for listProviders + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listProviders(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(String.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get a list of all update names that match the specified provider. + * + * @param provider Update provider. + * @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 a list of all update names that match the specified provider as paginated response with + * {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listNames(String provider) { + // Generated convenience method for listNames + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listNames(provider, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(String.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get a list of all update versions that match the specified provider and name. + * + * @param provider Update provider. + * @param name Update name. + * @param filter Optional to filter updates by isDeployable property. + * @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 a list of all update versions that match the specified provider and name as paginated response with + * {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listVersions(String provider, String name, String filter) { + // Generated convenience method for listVersions + RequestOptions requestOptions = new RequestOptions(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + PagedFlux pagedFluxResponse = listVersions(provider, name, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(String.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get a list of all update versions that match the specified provider and name. + * + * @param provider Update provider. + * @param name Update name. + * @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 a list of all update versions that match the specified provider and name as paginated response with + * {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listVersions(String provider, String name) { + // Generated convenience method for listVersions + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listVersions(provider, name, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(String.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get a list of all update file identifiers for the specified version. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a list of all update file identifiers for the specified version as paginated response with + * {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listFiles(String provider, String name, String version) { + // Generated convenience method for listFiles + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listFiles(provider, name, version, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(String.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get a specific update file from the version. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param fileId File identifier. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if + * the ETag on the server does not match this value. + * @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 a specific update file from the version on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getFile(String provider, String name, String version, String fileId, String ifNoneMatch) { + // Generated convenience method for getFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + return getFileWithResponse(provider, name, version, fileId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UpdateFile.class)); + } + + /** + * Get a specific update file from the version. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param fileId File identifier. + * @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 a specific update file from the version on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getFile(String provider, String name, String version, String fileId) { + // Generated convenience method for getFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFileWithResponse(provider, name, version, fileId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UpdateFile.class)); + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 + * days before auto-deleted. Delete operations are not returned by this API + * version. + * + * @param filter Optional to filter operations by status property. Only one specific filter is + * supported: "status eq 'NotStarted' or status eq 'Running'". + * @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 a list of all import update operations as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listOperationStatuses(String filter) { + // Generated convenience method for listOperationStatuses + RequestOptions requestOptions = new RequestOptions(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + PagedFlux pagedFluxResponse = listOperationStatuses(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(UpdateOperation.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 + * days before auto-deleted. Delete operations are not returned by this API + * version. + * + * @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 a list of all import update operations as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listOperationStatuses() { + // Generated convenience method for listOperationStatuses + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listOperationStatuses(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(UpdateOperation.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Retrieve operation status. + * + * @param operationId Operation identifier. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if + * the ETag on the server does not match this value. + * @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 operation metadata on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getOperationStatus(String operationId, String ifNoneMatch) { + // Generated convenience method for getOperationStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + return getOperationStatusWithResponse(operationId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UpdateOperation.class)); + } + + /** + * Retrieve operation status. + * + * @param operationId Operation identifier. + * @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 operation metadata on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getOperationStatus(String operationId) { + // Generated convenience method for getOperationStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getOperationStatusWithResponse(operationId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UpdateOperation.class)); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/SoftwareUpdateClient.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/SoftwareUpdateClient.java new file mode 100644 index 000000000000..4506be7b703f --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/SoftwareUpdateClient.java @@ -0,0 +1,1023 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.SyncPoller; +import com.azure.iot.deviceregistry.softwareupdate.implementation.SoftwareUpdatesImpl; +import com.azure.iot.deviceregistry.softwareupdate.models.ImportUpdateRequest; +import com.azure.iot.deviceregistry.softwareupdate.models.Update; +import com.azure.iot.deviceregistry.softwareupdate.models.UpdateFile; +import com.azure.iot.deviceregistry.softwareupdate.models.UpdateOperation; + +/** + * Initializes a new instance of the synchronous DeviceRegistrySoftwareUpdateClient type. + */ +@ServiceClient(builder = DeviceRegistrySoftwareUpdateClientBuilder.class) +public final class SoftwareUpdateClient { + @Generated + private final SoftwareUpdatesImpl serviceClient; + + /** + * Initializes an instance of SoftwareUpdateClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SoftwareUpdateClient(SoftwareUpdatesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get a list of all updates that have been imported to Software Update for Device + * Registry. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
searchStringNoRequest updates matching a free-text search + * expression.
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all updates that have been imported to Software Update for Device + * Registry as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUpdates(RequestOptions requestOptions) { + return this.serviceClient.listUpdates(requestOptions); + } + + /** + * Import new update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     importUpdateInput (Required): [
+     *          (Required){
+     *             importManifest (Required): {
+     *                 url: String (Required)
+     *                 sizeInBytes: long (Required)
+     *                 hashes (Required): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *             friendlyName: String (Optional)
+     *             files (Optional): [
+     *                  (Optional){
+     *                     fileName: String (Required)
+     *                     url: String (Required)
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     *     enableScan: Boolean (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param importUpdateRequest The update to be imported (see schema + * https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + * details). + * @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 {@link SyncPoller} for polling of update metadata. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginImportUpdate(BinaryData importUpdateRequest, + RequestOptions requestOptions) { + return this.serviceClient.beginImportUpdate(importUpdateRequest, requestOptions); + } + + /** + * Get a specific update version. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a specific update version along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getUpdateWithResponse(String provider, String name, String version, + RequestOptions requestOptions) { + return this.serviceClient.getUpdateWithResponse(provider, name, version, requestOptions); + } + + /** + * Delete a specific update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDeleteUpdate(String provider, String name, String version, + RequestOptions requestOptions) { + return this.serviceClient.beginDeleteUpdate(provider, name, version, requestOptions); + } + + /** + * Get a list of all update providers that have been imported to Software Update for + * Device Registry. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @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 a list of all update providers that have been imported to Software Update for + * Device Registry as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listProviders(RequestOptions requestOptions) { + return this.serviceClient.listProviders(requestOptions); + } + + /** + * Get a list of all update names that match the specified provider. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @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 a list of all update names that match the specified provider as paginated response with + * {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listNames(String provider, RequestOptions requestOptions) { + return this.serviceClient.listNames(provider, requestOptions); + } + + /** + * Get a list of all update versions that match the specified provider and name. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @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 a list of all update versions that match the specified provider and name as paginated response with + * {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String provider, String name, RequestOptions requestOptions) { + return this.serviceClient.listVersions(provider, name, requestOptions); + } + + /** + * Get a list of all update file identifiers for the specified version. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a list of all update file identifiers for the specified version as paginated response with + * {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listFiles(String provider, String name, String version, + RequestOptions requestOptions) { + return this.serviceClient.listFiles(provider, name, version, requestOptions); + } + + /** + * Get a specific update file from the version. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     fileName: String (Required)
+     *     sizeInBytes: long (Required)
+     *     hashes (Required): {
+     *         String: String (Required)
+     *     }
+     *     mimeType: String (Optional)
+     *     scanResult: String (Optional)
+     *     scanDetails: String (Optional)
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     fileId: String (Required)
+     *     relatedFiles (Optional): [
+     *          (Optional){
+     *             fileName: String (Required)
+     *             sizeInBytes: long (Required)
+     *             hashes (Required): {
+     *                 String: String (Required)
+     *             }
+     *             mimeType: String (Optional)
+     *             scanResult: String (Optional)
+     *             scanDetails: String (Optional)
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     downloadHandler (Optional): {
+     *         id: String (Required)
+     *     }
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param fileId File identifier. + * @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 a specific update file from the version along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFileWithResponse(String provider, String name, String version, String fileId, + RequestOptions requestOptions) { + return this.serviceClient.getFileWithResponse(provider, name, version, fileId, requestOptions); + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 + * days before auto-deleted. Delete operations are not returned by this API + * version. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter operations by status property. Only one + * specific filter is + * supported: "status eq 'NotStarted' or status eq 'Running'"
maxpagesizeIntegerNoSpecifies a non-negative integer n that limits the number + * of items returned + * from a collection. The service returns the number of available items up to but + * not greater than the specified value n.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all import update operations as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperationStatuses(RequestOptions requestOptions) { + return this.serviceClient.listOperationStatuses(requestOptions); + } + + /** + * Retrieve operation status. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Headers

+ * + * + * + * + *
Response Headers
NameTypeDescription
Retry-AfterStringNumber of seconds to wait before checking the operation status + * again.
+ * + * @param operationId Operation identifier. + * @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 operation metadata along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationStatusWithResponse(String operationId, RequestOptions requestOptions) { + return this.serviceClient.getOperationStatusWithResponse(operationId, requestOptions); + } + + /** + * Get a list of all updates that have been imported to Software Update for Device + * Registry. + * + * @param search Request updates matching a free-text search expression. + * @param filter Optional to filter updates by isDeployable property. + * @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 a list of all updates that have been imported to Software Update for Device + * Registry as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUpdates(String search, String filter) { + // Generated convenience method for listUpdates + RequestOptions requestOptions = new RequestOptions(); + if (search != null) { + requestOptions.addQueryParam("search", search, false); + } + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + return serviceClient.listUpdates(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Update.class)); + } + + /** + * Get a list of all updates that have been imported to Software Update for Device + * Registry. + * + * @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 a list of all updates that have been imported to Software Update for Device + * Registry as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUpdates() { + // Generated convenience method for listUpdates + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listUpdates(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Update.class)); + } + + /** + * Import new update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param importUpdateRequest The update to be imported (see schema + * https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + * details). + * @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 {@link SyncPoller} for polling of update metadata. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginImportUpdate(ImportUpdateRequest importUpdateRequest) { + // Generated convenience method for beginImportUpdateWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginImportUpdateWithModel(BinaryData.fromObject(importUpdateRequest), requestOptions); + } + + /** + * Get a specific update version. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if + * the ETag on the server does not match this value. + * @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 a specific update version. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Update getUpdate(String provider, String name, String version, String ifNoneMatch) { + // Generated convenience method for getUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + return getUpdateWithResponse(provider, name, version, requestOptions).getValue().toObject(Update.class); + } + + /** + * Get a specific update version. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a specific update version. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Update getUpdate(String provider, String name, String version) { + // Generated convenience method for getUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getUpdateWithResponse(provider, name, version, requestOptions).getValue().toObject(Update.class); + } + + /** + * Delete a specific update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDeleteUpdate(String provider, String name, String version) { + // Generated convenience method for beginDeleteUpdateWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginDeleteUpdateWithModel(provider, name, version, requestOptions); + } + + /** + * Get a list of all update providers that have been imported to Software Update for + * Device Registry. + * + * @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 a list of all update providers that have been imported to Software Update for + * Device Registry as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listProviders() { + // Generated convenience method for listProviders + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listProviders(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(String.class)); + } + + /** + * Get a list of all update names that match the specified provider. + * + * @param provider Update provider. + * @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 a list of all update names that match the specified provider as paginated response with + * {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listNames(String provider) { + // Generated convenience method for listNames + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listNames(provider, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(String.class)); + } + + /** + * Get a list of all update versions that match the specified provider and name. + * + * @param provider Update provider. + * @param name Update name. + * @param filter Optional to filter updates by isDeployable property. + * @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 a list of all update versions that match the specified provider and name as paginated response with + * {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String provider, String name, String filter) { + // Generated convenience method for listVersions + RequestOptions requestOptions = new RequestOptions(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + return serviceClient.listVersions(provider, name, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(String.class)); + } + + /** + * Get a list of all update versions that match the specified provider and name. + * + * @param provider Update provider. + * @param name Update name. + * @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 a list of all update versions that match the specified provider and name as paginated response with + * {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String provider, String name) { + // Generated convenience method for listVersions + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listVersions(provider, name, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(String.class)); + } + + /** + * Get a list of all update file identifiers for the specified version. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a list of all update file identifiers for the specified version as paginated response with + * {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listFiles(String provider, String name, String version) { + // Generated convenience method for listFiles + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listFiles(provider, name, version, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(String.class)); + } + + /** + * Get a specific update file from the version. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param fileId File identifier. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if + * the ETag on the server does not match this value. + * @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 a specific update file from the version. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateFile getFile(String provider, String name, String version, String fileId, String ifNoneMatch) { + // Generated convenience method for getFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + return getFileWithResponse(provider, name, version, fileId, requestOptions).getValue() + .toObject(UpdateFile.class); + } + + /** + * Get a specific update file from the version. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param fileId File identifier. + * @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 a specific update file from the version. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateFile getFile(String provider, String name, String version, String fileId) { + // Generated convenience method for getFileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFileWithResponse(provider, name, version, fileId, requestOptions).getValue() + .toObject(UpdateFile.class); + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 + * days before auto-deleted. Delete operations are not returned by this API + * version. + * + * @param filter Optional to filter operations by status property. Only one specific filter is + * supported: "status eq 'NotStarted' or status eq 'Running'". + * @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 a list of all import update operations as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperationStatuses(String filter) { + // Generated convenience method for listOperationStatuses + RequestOptions requestOptions = new RequestOptions(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + return serviceClient.listOperationStatuses(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(UpdateOperation.class)); + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 + * days before auto-deleted. Delete operations are not returned by this API + * version. + * + * @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 a list of all import update operations as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperationStatuses() { + // Generated convenience method for listOperationStatuses + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listOperationStatuses(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(UpdateOperation.class)); + } + + /** + * Retrieve operation status. + * + * @param operationId Operation identifier. + * @param ifNoneMatch Defines the If-None-Match condition. The operation will be performed only if + * the ETag on the server does not match this value. + * @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 operation metadata. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateOperation getOperationStatus(String operationId, String ifNoneMatch) { + // Generated convenience method for getOperationStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + return getOperationStatusWithResponse(operationId, requestOptions).getValue().toObject(UpdateOperation.class); + } + + /** + * Retrieve operation status. + * + * @param operationId Operation identifier. + * @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 operation metadata. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateOperation getOperationStatus(String operationId) { + // Generated convenience method for getOperationStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getOperationStatusWithResponse(operationId, requestOptions).getValue().toObject(UpdateOperation.class); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/DeviceClassesImpl.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/DeviceClassesImpl.java new file mode 100644 index 000000000000..49de65b27a67 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/DeviceClassesImpl.java @@ -0,0 +1,549 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.iot.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateServiceVersion; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DeviceClasses. + */ +public final class DeviceClassesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DeviceClassesService service; + + /** + * The service client containing this operation class. + */ + private final DeviceRegistrySoftwareUpdateClientImpl client; + + /** + * Initializes an instance of DeviceClassesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeviceClassesImpl(DeviceRegistrySoftwareUpdateClientImpl client) { + this.service + = RestProxy.create(DeviceClassesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public DeviceRegistrySoftwareUpdateServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for DeviceRegistrySoftwareUpdateClientDeviceClasses to be used by the + * proxy service to perform REST calls. + */ + @Host("https://{endpoint}") + @ServiceInterface(name = "DeviceRegistrySoftwareUpdateClientDeviceClasses") + public interface DeviceClassesService { + @Get("/management/deviceClasses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/management/deviceClasses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/management/deviceClasses/{deviceClassId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDeviceClass(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("deviceClassId") String deviceClassId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/management/deviceClasses/{deviceClassId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDeviceClassSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("deviceClassId") String deviceClassId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Delete("/management/deviceClasses/{deviceClassId}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("deviceClassId") String deviceClassId, + RequestOptions requestOptions, Context context); + + @Delete("/management/deviceClasses/{deviceClassId}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("deviceClassId") String deviceClassId, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Gets a list of device classes. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @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 a list of device classes along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Gets a list of device classes. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @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 a list of device classes as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listSinglePageAsync(requestOptions), + nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Gets a list of device classes. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @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 a list of device classes along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Gets a list of device classes. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @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 a list of device classes as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listSinglePage(requestOptions), + nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Gets the properties of a device class. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param deviceClassId Device class identifier. + * @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 properties of a device class along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDeviceClassWithResponseAsync(String deviceClassId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getDeviceClass(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), deviceClassId, accept, requestOptions, context)); + } + + /** + * Gets the properties of a device class. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param deviceClassId Device class identifier. + * @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 properties of a device class along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDeviceClassWithResponse(String deviceClassId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDeviceClassSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + deviceClassId, accept, requestOptions, Context.NONE); + } + + /** + * Deletes a device class. + * + * @param deviceClassId Device class identifier. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String deviceClassId, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), deviceClassId, requestOptions, context)); + } + + /** + * Deletes a device class. + * + * @param deviceClassId Device class identifier. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String deviceClassId, RequestOptions requestOptions) { + return service.deleteSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + deviceClassId, requestOptions, Context.NONE); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of device classes along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     deviceClassId: String (Required)
+     *     deviceClassProperties (Required): {
+     *         compatProperties (Required): {
+     *             String: String (Required)
+     *         }
+     *         agentProfile: int (Required)
+     *     }
+     *     bestCompatibleUpdate (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of device classes along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String... path) { + try { + Object value = binaryData.toObject(Map.class); + for (String segment : path) { + value = ((Map) value).get(segment); + } + List values = (List) value; + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String... path) { + try { + Object value = binaryData.toObject(Map.class); + for (String segment : path) { + value = ((Map) value).get(segment); + } + return (String) value; + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateClientImpl.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateClientImpl.java new file mode 100644 index 000000000000..ad96b556e1c0 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateClientImpl.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.iot.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateServiceVersion; + +/** + * Initializes a new instance of the DeviceRegistrySoftwareUpdateClient type. + */ +public final class DeviceRegistrySoftwareUpdateClientImpl { + /** + * The Software Update for Device Registry account endpoint (hostname only, no protocol). + */ + private final String endpoint; + + /** + * Gets The Software Update for Device Registry account endpoint (hostname only, no protocol). + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final DeviceRegistrySoftwareUpdateServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public DeviceRegistrySoftwareUpdateServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The DeviceClassesImpl object to access its operations. + */ + private final DeviceClassesImpl deviceClasses; + + /** + * Gets the DeviceClassesImpl object to access its operations. + * + * @return the DeviceClassesImpl object. + */ + public DeviceClassesImpl getDeviceClasses() { + return this.deviceClasses; + } + + /** + * The SoftwareUpdatesImpl object to access its operations. + */ + private final SoftwareUpdatesImpl softwareUpdates; + + /** + * Gets the SoftwareUpdatesImpl object to access its operations. + * + * @return the SoftwareUpdatesImpl object. + */ + public SoftwareUpdatesImpl getSoftwareUpdates() { + return this.softwareUpdates; + } + + /** + * Initializes an instance of DeviceRegistrySoftwareUpdateClient client. + * + * @param endpoint The Software Update for Device Registry account endpoint (hostname only, no protocol). + * @param serviceVersion Service version. + */ + public DeviceRegistrySoftwareUpdateClientImpl(String endpoint, + DeviceRegistrySoftwareUpdateServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of DeviceRegistrySoftwareUpdateClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint The Software Update for Device Registry account endpoint (hostname only, no protocol). + * @param serviceVersion Service version. + */ + public DeviceRegistrySoftwareUpdateClientImpl(HttpPipeline httpPipeline, String endpoint, + DeviceRegistrySoftwareUpdateServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of DeviceRegistrySoftwareUpdateClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint The Software Update for Device Registry account endpoint (hostname only, no protocol). + * @param serviceVersion Service version. + */ + public DeviceRegistrySoftwareUpdateClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint, DeviceRegistrySoftwareUpdateServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.deviceClasses = new DeviceClassesImpl(this); + this.softwareUpdates = new SoftwareUpdatesImpl(this); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/SoftwareUpdatesImpl.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/SoftwareUpdatesImpl.java new file mode 100644 index 000000000000..70fa206ad81b --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/SoftwareUpdatesImpl.java @@ -0,0 +1,3235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.UrlBuilder; +import com.azure.core.util.polling.DefaultPollingStrategy; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncDefaultPollingStrategy; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.TypeReference; +import com.azure.iot.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateServiceVersion; +import com.azure.iot.deviceregistry.softwareupdate.models.UpdateOperation; +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SoftwareUpdates. + */ +public final class SoftwareUpdatesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SoftwareUpdatesService service; + + /** + * The service client containing this operation class. + */ + private final DeviceRegistrySoftwareUpdateClientImpl client; + + /** + * Initializes an instance of SoftwareUpdatesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SoftwareUpdatesImpl(DeviceRegistrySoftwareUpdateClientImpl client) { + this.service + = RestProxy.create(SoftwareUpdatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public DeviceRegistrySoftwareUpdateServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for DeviceRegistrySoftwareUpdateClientSoftwareUpdates to be used by the + * proxy service to perform REST calls. + */ + @Host("https://{endpoint}") + @ServiceInterface(name = "DeviceRegistrySoftwareUpdateClientSoftwareUpdates") + public interface SoftwareUpdatesService { + @Get("/updates") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listUpdates(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/updates") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listUpdatesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/updates:import") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> importUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData importUpdateRequest, + RequestOptions requestOptions, Context context); + + @Post("/updates:import") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response importUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData importUpdateRequest, + RequestOptions requestOptions, Context context); + + @Get("/updates/providers/{provider}/names/{name}/versions/{version}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @PathParam("name") String name, @PathParam("version") String version, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/updates/providers/{provider}/names/{name}/versions/{version}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @PathParam("name") String name, @PathParam("version") String version, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Delete("/updates/providers/{provider}/names/{name}/versions/{version}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @PathParam("name") String name, @PathParam("version") String version, RequestOptions requestOptions, + Context context); + + @Delete("/updates/providers/{provider}/names/{name}/versions/{version}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @PathParam("name") String name, @PathParam("version") String version, RequestOptions requestOptions, + Context context); + + @Get("/updates/providers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listProviders(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/updates/providers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listProvidersSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/updates/providers/{provider}/names") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listNames(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/updates/providers/{provider}/names") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listNamesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/updates/providers/{provider}/names/{name}/versions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listVersions(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @PathParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/updates/providers/{provider}/names/{name}/versions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listVersionsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @PathParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/updates/providers/{provider}/names/{name}/versions/{version}/files") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listFiles(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @PathParam("name") String name, @PathParam("version") String version, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/updates/providers/{provider}/names/{name}/versions/{version}/files") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listFilesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @PathParam("name") String name, @PathParam("version") String version, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/updates/providers/{provider}/names/{name}/versions/{version}/files/{fileId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getFile(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @PathParam("name") String name, @PathParam("version") String version, @PathParam("fileId") String fileId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/updates/providers/{provider}/names/{name}/versions/{version}/files/{fileId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getFileSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("provider") String provider, + @PathParam("name") String name, @PathParam("version") String version, @PathParam("fileId") String fileId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/updates/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listOperationStatuses(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/updates/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listOperationStatusesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/updates/operations/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getOperationStatus(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/updates/operations/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getOperationStatusSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listUpdatesNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listUpdatesNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listProvidersNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listProvidersNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listNamesNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listNamesNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listVersionsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listVersionsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listFilesNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listFilesNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listOperationStatusesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listOperationStatusesNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * Get a list of all updates that have been imported to Software Update for Device + * Registry. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
searchStringNoRequest updates matching a free-text search + * expression.
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all updates that have been imported to Software Update for Device + * Registry along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUpdatesSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listUpdates(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get a list of all updates that have been imported to Software Update for Device + * Registry. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
searchStringNoRequest updates matching a free-text search + * expression.
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all updates that have been imported to Software Update for Device + * Registry as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listUpdatesAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listUpdatesSinglePageAsync(requestOptions), + nextLink -> listUpdatesNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Get a list of all updates that have been imported to Software Update for Device + * Registry. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
searchStringNoRequest updates matching a free-text search + * expression.
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all updates that have been imported to Software Update for Device + * Registry along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listUpdatesSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listUpdatesSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get a list of all updates that have been imported to Software Update for Device + * Registry. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
searchStringNoRequest updates matching a free-text search + * expression.
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all updates that have been imported to Software Update for Device + * Registry as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUpdates(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listUpdatesSinglePage(requestOptions), + nextLink -> listUpdatesNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Import new update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     importUpdateInput (Required): [
+     *          (Required){
+     *             importManifest (Required): {
+     *                 url: String (Required)
+     *                 sizeInBytes: long (Required)
+     *                 hashes (Required): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *             friendlyName: String (Optional)
+     *             files (Optional): [
+     *                  (Optional){
+     *                     fileName: String (Required)
+     *                     url: String (Required)
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     *     enableScan: Boolean (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param importUpdateRequest The update to be imported (see schema + * https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + * details). + * @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 update metadata along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> importUpdateWithResponseAsync(BinaryData importUpdateRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.importUpdate(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + contentType, accept, importUpdateRequest, requestOptions, context)); + } + + /** + * Import new update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     importUpdateInput (Required): [
+     *          (Required){
+     *             importManifest (Required): {
+     *                 url: String (Required)
+     *                 sizeInBytes: long (Required)
+     *                 hashes (Required): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *             friendlyName: String (Optional)
+     *             files (Optional): [
+     *                  (Optional){
+     *                     fileName: String (Required)
+     *                     url: String (Required)
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     *     enableScan: Boolean (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param importUpdateRequest The update to be imported (see schema + * https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + * details). + * @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 update metadata along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response importUpdateWithResponse(BinaryData importUpdateRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.importUpdateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + contentType, accept, importUpdateRequest, requestOptions, Context.NONE); + } + + /** + * Import new update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     importUpdateInput (Required): [
+     *          (Required){
+     *             importManifest (Required): {
+     *                 url: String (Required)
+     *                 sizeInBytes: long (Required)
+     *                 hashes (Required): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *             friendlyName: String (Optional)
+     *             files (Optional): [
+     *                  (Optional){
+     *                     fileName: String (Required)
+     *                     url: String (Required)
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     *     enableScan: Boolean (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param importUpdateRequest The update to be imported (see schema + * https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + * details). + * @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 {@link PollerFlux} for polling of update metadata. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginImportUpdateWithModelAsync(BinaryData importUpdateRequest, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.importUpdateWithResponseAsync(importUpdateRequest, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("https://{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(UpdateOperation.class), TypeReference.createInstance(Void.class)); + } + + /** + * Import new update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     importUpdateInput (Required): [
+     *          (Required){
+     *             importManifest (Required): {
+     *                 url: String (Required)
+     *                 sizeInBytes: long (Required)
+     *                 hashes (Required): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *             friendlyName: String (Optional)
+     *             files (Optional): [
+     *                  (Optional){
+     *                     fileName: String (Required)
+     *                     url: String (Required)
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     *     enableScan: Boolean (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param importUpdateRequest The update to be imported (see schema + * https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + * details). + * @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 {@link SyncPoller} for polling of update metadata. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginImportUpdateWithModel(BinaryData importUpdateRequest, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.importUpdateWithResponse(importUpdateRequest, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("https://{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(UpdateOperation.class), TypeReference.createInstance(Void.class)); + } + + /** + * Import new update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     importUpdateInput (Required): [
+     *          (Required){
+     *             importManifest (Required): {
+     *                 url: String (Required)
+     *                 sizeInBytes: long (Required)
+     *                 hashes (Required): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *             friendlyName: String (Optional)
+     *             files (Optional): [
+     *                  (Optional){
+     *                     fileName: String (Required)
+     *                     url: String (Required)
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     *     enableScan: Boolean (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param importUpdateRequest The update to be imported (see schema + * https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + * details). + * @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 {@link PollerFlux} for polling of update metadata. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginImportUpdateAsync(BinaryData importUpdateRequest, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.importUpdateWithResponseAsync(importUpdateRequest, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("https://{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Import new update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     importUpdateInput (Required): [
+     *          (Required){
+     *             importManifest (Required): {
+     *                 url: String (Required)
+     *                 sizeInBytes: long (Required)
+     *                 hashes (Required): {
+     *                     String: String (Required)
+     *                 }
+     *             }
+     *             friendlyName: String (Optional)
+     *             files (Optional): [
+     *                  (Optional){
+     *                     fileName: String (Required)
+     *                     url: String (Required)
+     *                 }
+     *             ]
+     *         }
+     *     ]
+     *     enableScan: Boolean (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param importUpdateRequest The update to be imported (see schema + * https://json.schemastore.org/azure-deviceupdate-import-manifest-5.0.json for + * details). + * @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 {@link SyncPoller} for polling of update metadata. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginImportUpdate(BinaryData importUpdateRequest, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.importUpdateWithResponse(importUpdateRequest, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("https://{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Get a specific update version. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a specific update version along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getUpdateWithResponseAsync(String provider, String name, String version, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getUpdate(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), provider, name, version, accept, requestOptions, context)); + } + + /** + * Get a specific update version. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a specific update version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getUpdateWithResponse(String provider, String name, String version, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getUpdateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), provider, + name, version, accept, requestOptions, Context.NONE); + } + + /** + * Delete a specific update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteUpdateWithResponseAsync(String provider, String name, String version, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.deleteUpdate(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), provider, name, version, requestOptions, context)); + } + + /** + * Delete a specific update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteUpdateWithResponse(String provider, String name, String version, + RequestOptions requestOptions) { + return service.deleteUpdateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + provider, name, version, requestOptions, Context.NONE); + } + + /** + * Delete a specific update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDeleteUpdateWithModelAsync(String provider, String name, + String version, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.deleteUpdateWithResponseAsync(provider, name, version, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("https://{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(UpdateOperation.class), TypeReference.createInstance(Void.class)); + } + + /** + * Delete a specific update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDeleteUpdateWithModel(String provider, String name, String version, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.deleteUpdateWithResponse(provider, name, version, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("https://{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(UpdateOperation.class), TypeReference.createInstance(Void.class)); + } + + /** + * Delete a specific update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDeleteUpdateAsync(String provider, String name, String version, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.deleteUpdateWithResponseAsync(provider, name, version, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("https://{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(Void.class)); + } + + /** + * Delete a specific update version. This is a long-running-operation; use + * Operation-Location response header value to check for operation status. + * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDeleteUpdate(String provider, String name, String version, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.deleteUpdateWithResponse(provider, name, version, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("https://{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(Void.class)); + } + + /** + * Get a list of all update providers that have been imported to Software Update for + * Device Registry. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @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 a list of all update providers that have been imported to Software Update for + * Device Registry along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listProvidersSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listProviders(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get a list of all update providers that have been imported to Software Update for + * Device Registry. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @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 a list of all update providers that have been imported to Software Update for + * Device Registry as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listProvidersAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listProvidersSinglePageAsync(requestOptions), + nextLink -> listProvidersNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Get a list of all update providers that have been imported to Software Update for + * Device Registry. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @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 a list of all update providers that have been imported to Software Update for + * Device Registry along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listProvidersSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listProvidersSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get a list of all update providers that have been imported to Software Update for + * Device Registry. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @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 a list of all update providers that have been imported to Software Update for + * Device Registry as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listProviders(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listProvidersSinglePage(requestOptions), + nextLink -> listProvidersNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get a list of all update names that match the specified provider. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @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 a list of all update names that match the specified provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNamesSinglePageAsync(String provider, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNames(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), provider, accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get a list of all update names that match the specified provider. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @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 a list of all update names that match the specified provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listNamesAsync(String provider, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listNamesSinglePageAsync(provider, requestOptions), + nextLink -> listNamesNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Get a list of all update names that match the specified provider. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @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 a list of all update names that match the specified provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNamesSinglePage(String provider, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listNamesSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), provider, accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get a list of all update names that match the specified provider. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @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 a list of all update names that match the specified provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listNames(String provider, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listNamesSinglePage(provider, requestOptions), + nextLink -> listNamesNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get a list of all update versions that match the specified provider and name. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @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 a list of all update versions that match the specified provider and name along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listVersionsSinglePageAsync(String provider, String name, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listVersions(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), provider, name, accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get a list of all update versions that match the specified provider and name. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @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 a list of all update versions that match the specified provider and name as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listVersionsAsync(String provider, String name, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listVersionsSinglePageAsync(provider, name, requestOptions), + nextLink -> listVersionsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Get a list of all update versions that match the specified provider and name. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @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 a list of all update versions that match the specified provider and name along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listVersionsSinglePage(String provider, String name, + RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listVersionsSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), provider, name, accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get a list of all update versions that match the specified provider and name. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter updates by isDeployable property.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @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 a list of all update versions that match the specified provider and name as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVersions(String provider, String name, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listVersionsSinglePage(provider, name, requestOptions), + nextLink -> listVersionsNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get a list of all update file identifiers for the specified version. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a list of all update file identifiers for the specified version along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listFilesSinglePageAsync(String provider, String name, String version, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listFiles(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), provider, name, version, accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get a list of all update file identifiers for the specified version. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a list of all update file identifiers for the specified version as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listFilesAsync(String provider, String name, String version, + RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listFilesSinglePageAsync(provider, name, version, requestOptions), + nextLink -> listFilesNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Get a list of all update file identifiers for the specified version. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a list of all update file identifiers for the specified version along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listFilesSinglePage(String provider, String name, String version, + RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listFilesSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), provider, + name, version, accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get a list of all update file identifiers for the specified version. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @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 a list of all update file identifiers for the specified version as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listFiles(String provider, String name, String version, + RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listFilesSinglePage(provider, name, version, requestOptions), + nextLink -> listFilesNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get a specific update file from the version. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     fileName: String (Required)
+     *     sizeInBytes: long (Required)
+     *     hashes (Required): {
+     *         String: String (Required)
+     *     }
+     *     mimeType: String (Optional)
+     *     scanResult: String (Optional)
+     *     scanDetails: String (Optional)
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     fileId: String (Required)
+     *     relatedFiles (Optional): [
+     *          (Optional){
+     *             fileName: String (Required)
+     *             sizeInBytes: long (Required)
+     *             hashes (Required): {
+     *                 String: String (Required)
+     *             }
+     *             mimeType: String (Optional)
+     *             scanResult: String (Optional)
+     *             scanDetails: String (Optional)
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     downloadHandler (Optional): {
+     *         id: String (Required)
+     *     }
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param fileId File identifier. + * @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 a specific update file from the version along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFileWithResponseAsync(String provider, String name, String version, + String fileId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getFile(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + provider, name, version, fileId, accept, requestOptions, context)); + } + + /** + * Get a specific update file from the version. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     fileName: String (Required)
+     *     sizeInBytes: long (Required)
+     *     hashes (Required): {
+     *         String: String (Required)
+     *     }
+     *     mimeType: String (Optional)
+     *     scanResult: String (Optional)
+     *     scanDetails: String (Optional)
+     *     properties (Optional): {
+     *         String: String (Required)
+     *     }
+     *     fileId: String (Required)
+     *     relatedFiles (Optional): [
+     *          (Optional){
+     *             fileName: String (Required)
+     *             sizeInBytes: long (Required)
+     *             hashes (Required): {
+     *                 String: String (Required)
+     *             }
+     *             mimeType: String (Optional)
+     *             scanResult: String (Optional)
+     *             scanDetails: String (Optional)
+     *             properties (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     downloadHandler (Optional): {
+     *         id: String (Required)
+     *     }
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param fileId File identifier. + * @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 a specific update file from the version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFileWithResponse(String provider, String name, String version, String fileId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getFileSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), provider, + name, version, fileId, accept, requestOptions, Context.NONE); + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 + * days before auto-deleted. Delete operations are not returned by this API + * version. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter operations by status property. Only one + * specific filter is + * supported: "status eq 'NotStarted' or status eq 'Running'"
maxpagesizeIntegerNoSpecifies a non-negative integer n that limits the number + * of items returned + * from a collection. The service returns the number of available items up to but + * not greater than the specified value n.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all import update operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationStatusesSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listOperationStatuses(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 + * days before auto-deleted. Delete operations are not returned by this API + * version. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter operations by status property. Only one + * specific filter is + * supported: "status eq 'NotStarted' or status eq 'Running'"
maxpagesizeIntegerNoSpecifies a non-negative integer n that limits the number + * of items returned + * from a collection. The service returns the number of available items up to but + * not greater than the specified value n.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all import update operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listOperationStatusesAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listOperationStatusesSinglePageAsync(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listOperationStatusesNextSinglePageAsync(nextLink, requestOptionsLocal); + }); + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 + * days before auto-deleted. Delete operations are not returned by this API + * version. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter operations by status property. Only one + * specific filter is + * supported: "status eq 'NotStarted' or status eq 'Running'"
maxpagesizeIntegerNoSpecifies a non-negative integer n that limits the number + * of items returned + * from a collection. The service returns the number of available items up to but + * not greater than the specified value n.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all import update operations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listOperationStatusesSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listOperationStatusesSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 + * days before auto-deleted. Delete operations are not returned by this API + * version. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOptional to filter operations by status property. Only one + * specific filter is + * supported: "status eq 'NotStarted' or status eq 'Running'"
maxpagesizeIntegerNoSpecifies a non-negative integer n that limits the number + * of items returned + * from a collection. The service returns the number of available items up to but + * not greater than the specified value n.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @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 a list of all import update operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperationStatuses(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listOperationStatusesSinglePage(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listOperationStatusesNextSinglePage(nextLink, requestOptionsLocal); + }); + } + + /** + * Retrieve operation status. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Headers

+ * + * + * + * + *
Response Headers
NameTypeDescription
Retry-AfterStringNumber of seconds to wait before checking the operation status + * again.
+ * + * @param operationId Operation identifier. + * @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 operation metadata along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationStatusWithResponseAsync(String operationId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getOperationStatus(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), operationId, accept, requestOptions, context)); + } + + /** + * Retrieve operation status. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoDefines the If-None-Match condition. The operation will + * be performed only if + * the ETag on the server does not match this value.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Headers

+ * + * + * + * + *
Response Headers
NameTypeDescription
Retry-AfterStringNumber of seconds to wait before checking the operation status + * again.
+ * + * @param operationId Operation identifier. + * @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 operation metadata along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationStatusWithResponse(String operationId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getOperationStatusSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + operationId, accept, requestOptions, Context.NONE); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all updates that have been imported to Software Update for Device + * Registry along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUpdatesNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listUpdatesNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     updateId (Required): {
+     *         provider: String (Required)
+     *         name: String (Required)
+     *         version: String (Required)
+     *     }
+     *     description: String (Optional)
+     *     friendlyName: String (Optional)
+     *     isDeployable: Boolean (Optional)
+     *     updateType: String (Optional)
+     *     installedCriteria: String (Optional)
+     *     compatibility (Required): [
+     *          (Required){
+     *              (Optional): {
+     *                 String: String (Required)
+     *             }
+     *         }
+     *     ]
+     *     instructions (Optional): {
+     *         steps (Required): [
+     *              (Required){
+     *                 type: String(inline/reference) (Optional)
+     *                 description: String (Optional)
+     *                 handler: String (Optional)
+     *                 handlerProperties (Optional): {
+     *                     String: BinaryData (Required)
+     *                 }
+     *                 fileNames (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 updateId (Optional): (recursive schema, see updateId above)
+     *             }
+     *         ]
+     *     }
+     *     referencedBy (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     scanResult: String (Optional)
+     *     manifestVersion: String (Required)
+     *     importedDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all updates that have been imported to Software Update for Device + * Registry along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listUpdatesNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listUpdatesNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all update providers that have been imported to Software Update for + * Device Registry along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listProvidersNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listProvidersNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all update providers that have been imported to Software Update for + * Device Registry along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listProvidersNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listProvidersNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all update names that match the specified provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNamesNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNamesNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all update names that match the specified provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNamesNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listNamesNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all update versions that match the specified provider and name along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listVersionsNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listVersionsNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all update versions that match the specified provider and name along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listVersionsNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listVersionsNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all update file identifiers for the specified version along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listFilesNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listFilesNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all update file identifiers for the specified version along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listFilesNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listFilesNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all import update operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationStatusesNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listOperationStatusesNext(nextLink, this.client.getEndpoint(), accept, + requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationId: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     update (Optional): {
+     *         updateId (Required): {
+     *             provider: String (Required)
+     *             name: String (Required)
+     *             version: String (Required)
+     *         }
+     *         description: String (Optional)
+     *         friendlyName: String (Optional)
+     *     }
+     *     resourceLocation: String (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     traceId: String (Optional)
+     *     lastActionDateTime: OffsetDateTime (Required)
+     *     createdDateTime: OffsetDateTime (Required)
+     *     etag: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @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 a list of all import update operations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listOperationStatusesNextSinglePage(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listOperationStatusesNextSync(nextLink, this.client.getEndpoint(), accept, + requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String... path) { + try { + Object value = binaryData.toObject(Map.class); + for (String segment : path) { + value = ((Map) value).get(segment); + } + List values = (List) value; + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String... path) { + try { + Object value = binaryData.toObject(Map.class); + for (String segment : path) { + value = ((Map) value).get(segment); + } + return (String) value; + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/package-info.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/package-info.java new file mode 100644 index 000000000000..bba03fc400fe --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for DeviceRegistrySoftwareUpdateClient. + * Software Update for Device Registry is an Azure service that enables customers to publish updates for their IoT + * devices to the cloud, and then deploy that update to their devices (approve updates to groups of devices managed and + * provisioned in Device Registry). It leverages the proven security and reliability of the Windows Update platform, + * optimized for IoT devices. It works globally and knows when and how to update devices, enabling customers to focus on + * their business goals and let Software Update for Device Registry handle the updates. + */ +package com.azure.iot.deviceregistry.softwareupdate.implementation; diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/BestCompatibleUpdate.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/BestCompatibleUpdate.java new file mode 100644 index 000000000000..0ba7468e8dc8 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/BestCompatibleUpdate.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +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 best compatible update for a device class. + */ +@Immutable +public final class BestCompatibleUpdate implements JsonSerializable { + /* + * The identifier of the best-available compatible update. + */ + @Generated + private final UpdateId updateId; + + /** + * Creates an instance of BestCompatibleUpdate class. + * + * @param updateId the updateId value to set. + */ + @Generated + private BestCompatibleUpdate(UpdateId updateId) { + this.updateId = updateId; + } + + /** + * Get the updateId property: The identifier of the best-available compatible update. + * + * @return the updateId value. + */ + @Generated + public UpdateId getUpdateId() { + return this.updateId; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("updateId", this.updateId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BestCompatibleUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BestCompatibleUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BestCompatibleUpdate. + */ + @Generated + public static BestCompatibleUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateId updateId = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("updateId".equals(fieldName)) { + updateId = UpdateId.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new BestCompatibleUpdate(updateId); + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Compatibility.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Compatibility.java new file mode 100644 index 000000000000..8652e7f1651c --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Compatibility.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +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; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Key-value pairs representing update compatibility information. + */ +@Immutable +public final class Compatibility implements JsonSerializable { + /* + * Key-value pairs representing update compatibility information. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of Compatibility class. + */ + @Generated + private Compatibility() { + } + + /** + * Get the additionalProperties property: Key-value pairs representing update compatibility information. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Compatibility from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Compatibility 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 Compatibility. + */ + @Generated + public static Compatibility fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Compatibility deserializedCompatibility = new Compatibility(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.getString()); + } + deserializedCompatibility.additionalProperties = additionalProperties; + + return deserializedCompatibility; + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/DeviceClass.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/DeviceClass.java new file mode 100644 index 000000000000..77345ac56317 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/DeviceClass.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * A device class groups devices that share compatibility properties and agent + * profile, allowing the service to determine the best compatible update for them. + */ +@Immutable +public final class DeviceClass implements JsonSerializable { + /* + * Identifier derived from deviceClassProperties encoded as a 16-character + * lowercase hexadecimal string. + */ + @Generated + private String deviceClassId; + + /* + * The properties that identify this device class. + */ + @Generated + private DeviceClassProperties deviceClassProperties; + + /* + * The best compatible update for the devices in this class, if any. + */ + @Generated + private BestCompatibleUpdate bestCompatibleUpdate; + + /** + * Creates an instance of DeviceClass class. + */ + @Generated + private DeviceClass() { + } + + /** + * Get the deviceClassId property: Identifier derived from deviceClassProperties encoded as a 16-character + * lowercase hexadecimal string. + * + * @return the deviceClassId value. + */ + @Generated + public String getDeviceClassId() { + return this.deviceClassId; + } + + /** + * Get the deviceClassProperties property: The properties that identify this device class. + * + * @return the deviceClassProperties value. + */ + @Generated + public DeviceClassProperties getDeviceClassProperties() { + return this.deviceClassProperties; + } + + /** + * Get the bestCompatibleUpdate property: The best compatible update for the devices in this class, if any. + * + * @return the bestCompatibleUpdate value. + */ + @Generated + public BestCompatibleUpdate getBestCompatibleUpdate() { + return this.bestCompatibleUpdate; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceClass from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceClass if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DeviceClass. + */ + @Generated + public static DeviceClass fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceClass deserializedDeviceClass = new DeviceClass(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceClassId".equals(fieldName)) { + deserializedDeviceClass.deviceClassId = reader.getString(); + } else if ("deviceClassProperties".equals(fieldName)) { + deserializedDeviceClass.deviceClassProperties = DeviceClassProperties.fromJson(reader); + } else if ("bestCompatibleUpdate".equals(fieldName)) { + deserializedDeviceClass.bestCompatibleUpdate = BestCompatibleUpdate.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceClass; + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/DeviceClassProperties.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/DeviceClassProperties.java new file mode 100644 index 000000000000..d55de7fbeb2a --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/DeviceClassProperties.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +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; +import java.util.Map; + +/** + * Properties that identify a device class. + */ +@Immutable +public final class DeviceClassProperties implements JsonSerializable { + /* + * Free-form compatibility properties (e.g. manufacturer, model) used to match + * devices. This object can be thought of as a set of key-value pairs where the key + * is the name of the compatibility property and the value is the value of the + * compatibility property. There will always be at least 1 compat property. At most + * 5 entries are allowed. + */ + @Generated + private final Map compatProperties; + + /* + * The agent profile that devices in this class implement. + */ + @Generated + private final int agentProfile; + + /** + * Creates an instance of DeviceClassProperties class. + * + * @param compatProperties the compatProperties value to set. + * @param agentProfile the agentProfile value to set. + */ + @Generated + private DeviceClassProperties(Map compatProperties, int agentProfile) { + this.compatProperties = compatProperties; + this.agentProfile = agentProfile; + } + + /** + * Get the compatProperties property: Free-form compatibility properties (e.g. manufacturer, model) used to match + * devices. This object can be thought of as a set of key-value pairs where the key + * is the name of the compatibility property and the value is the value of the + * compatibility property. There will always be at least 1 compat property. At most + * 5 entries are allowed. + * + * @return the compatProperties value. + */ + @Generated + public Map getCompatProperties() { + return this.compatProperties; + } + + /** + * Get the agentProfile property: The agent profile that devices in this class implement. + * + * @return the agentProfile value. + */ + @Generated + public int getAgentProfile() { + return this.agentProfile; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("compatProperties", this.compatProperties, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeIntField("agentProfile", this.agentProfile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceClassProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceClassProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DeviceClassProperties. + */ + @Generated + public static DeviceClassProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Map compatProperties = null; + int agentProfile = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("compatProperties".equals(fieldName)) { + compatProperties = reader.readMap(reader1 -> reader1.getString()); + } else if ("agentProfile".equals(fieldName)) { + agentProfile = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new DeviceClassProperties(compatProperties, agentProfile); + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/FileImportMetadata.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/FileImportMetadata.java new file mode 100644 index 000000000000..822ce9cf9b1e --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/FileImportMetadata.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Metadata describing an update file. + */ +@Immutable +public final class FileImportMetadata implements JsonSerializable { + /* + * Update file name as specified inside import manifest. + */ + @Generated + private final String fileName; + + /* + * Azure Blob location from which the update file can be downloaded by Device + * Update for Device Registry. This is typically a read-only SAS-protected blob URL + * with an expiration set to at least 4 hours. + */ + @Generated + private final String url; + + /** + * Creates an instance of FileImportMetadata class. + * + * @param fileName the fileName value to set. + * @param url the url value to set. + */ + @Generated + public FileImportMetadata(String fileName, String url) { + this.fileName = fileName; + this.url = url; + } + + /** + * Get the fileName property: Update file name as specified inside import manifest. + * + * @return the fileName value. + */ + @Generated + public String getFileName() { + return this.fileName; + } + + /** + * Get the url property: Azure Blob location from which the update file can be downloaded by Device + * Update for Device Registry. This is typically a read-only SAS-protected blob URL + * with an expiration set to at least 4 hours. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fileName", this.fileName); + jsonWriter.writeStringField("url", this.url); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileImportMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileImportMetadata if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileImportMetadata. + */ + @Generated + public static FileImportMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String fileName = null; + String url = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fileName".equals(fieldName)) { + fileName = reader.getString(); + } else if ("url".equals(fieldName)) { + url = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new FileImportMetadata(fileName, url); + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportManifestMetadata.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportManifestMetadata.java new file mode 100644 index 000000000000..a9dc10020552 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportManifestMetadata.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +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; +import java.util.Map; + +/** + * Metadata describing the import manifest, a document which describes the files + * and other metadata about an update version. + */ +@Immutable +public final class ImportManifestMetadata implements JsonSerializable { + /* + * Azure Blob location from which the import manifest can be downloaded by Device + * Update for Device Registry. This is typically a read-only SAS-protected blob URL + * with an expiration set to at least 4 hours. + */ + @Generated + private final String url; + + /* + * File size in number of bytes. + */ + @Generated + private final long sizeInBytes; + + /* + * A JSON object containing the hash(es) of the file. At least SHA256 hash is + * required. This object can be thought of as a set of key-value pairs where the + * key is the hash algorithm, and the value is the hash of the file calculated + * using that algorithm. + */ + @Generated + private final Map hashes; + + /** + * Creates an instance of ImportManifestMetadata class. + * + * @param url the url value to set. + * @param sizeInBytes the sizeInBytes value to set. + * @param hashes the hashes value to set. + */ + @Generated + public ImportManifestMetadata(String url, long sizeInBytes, Map hashes) { + this.url = url; + this.sizeInBytes = sizeInBytes; + this.hashes = hashes; + } + + /** + * Get the url property: Azure Blob location from which the import manifest can be downloaded by Device + * Update for Device Registry. This is typically a read-only SAS-protected blob URL + * with an expiration set to at least 4 hours. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } + + /** + * Get the sizeInBytes property: File size in number of bytes. + * + * @return the sizeInBytes value. + */ + @Generated + public long getSizeInBytes() { + return this.sizeInBytes; + } + + /** + * Get the hashes property: A JSON object containing the hash(es) of the file. At least SHA256 hash is + * required. This object can be thought of as a set of key-value pairs where the + * key is the hash algorithm, and the value is the hash of the file calculated + * using that algorithm. + * + * @return the hashes value. + */ + @Generated + public Map getHashes() { + return this.hashes; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeLongField("sizeInBytes", this.sizeInBytes); + jsonWriter.writeMapField("hashes", this.hashes, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImportManifestMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImportManifestMetadata if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ImportManifestMetadata. + */ + @Generated + public static ImportManifestMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String url = null; + long sizeInBytes = 0L; + Map hashes = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("url".equals(fieldName)) { + url = reader.getString(); + } else if ("sizeInBytes".equals(fieldName)) { + sizeInBytes = reader.getLong(); + } else if ("hashes".equals(fieldName)) { + hashes = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + return new ImportManifestMetadata(url, sizeInBytes, hashes); + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportUpdateInputItem.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportUpdateInputItem.java new file mode 100644 index 000000000000..1ce68acd1741 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportUpdateInputItem.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Import update input item metadata. + */ +@Fluent +public final class ImportUpdateInputItem implements JsonSerializable { + /* + * Import manifest metadata like source URL, file size/hashes, etc. + */ + @Generated + private final ImportManifestMetadata importManifest; + + /* + * Friendly update name. + */ + @Generated + private String friendlyName; + + /* + * One or more update file properties like file name and source URL. + */ + @Generated + private List files; + + /** + * Creates an instance of ImportUpdateInputItem class. + * + * @param importManifest the importManifest value to set. + */ + @Generated + public ImportUpdateInputItem(ImportManifestMetadata importManifest) { + this.importManifest = importManifest; + } + + /** + * Get the importManifest property: Import manifest metadata like source URL, file size/hashes, etc. + * + * @return the importManifest value. + */ + @Generated + public ImportManifestMetadata getImportManifest() { + return this.importManifest; + } + + /** + * Get the friendlyName property: Friendly update name. + * + * @return the friendlyName value. + */ + @Generated + public String getFriendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Friendly update name. + * + * @param friendlyName the friendlyName value to set. + * @return the ImportUpdateInputItem object itself. + */ + @Generated + public ImportUpdateInputItem setFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the files property: One or more update file properties like file name and source URL. + * + * @return the files value. + */ + @Generated + public List getFiles() { + return this.files; + } + + /** + * Set the files property: One or more update file properties like file name and source URL. + * + * @param files the files value to set. + * @return the ImportUpdateInputItem object itself. + */ + @Generated + public ImportUpdateInputItem setFiles(List files) { + this.files = files; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("importManifest", this.importManifest); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeArrayField("files", this.files, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImportUpdateInputItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImportUpdateInputItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ImportUpdateInputItem. + */ + @Generated + public static ImportUpdateInputItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImportManifestMetadata importManifest = null; + String friendlyName = null; + List files = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("importManifest".equals(fieldName)) { + importManifest = ImportManifestMetadata.fromJson(reader); + } else if ("friendlyName".equals(fieldName)) { + friendlyName = reader.getString(); + } else if ("files".equals(fieldName)) { + files = reader.readArray(reader1 -> FileImportMetadata.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + ImportUpdateInputItem deserializedImportUpdateInputItem = new ImportUpdateInputItem(importManifest); + deserializedImportUpdateInputItem.friendlyName = friendlyName; + deserializedImportUpdateInputItem.files = files; + + return deserializedImportUpdateInputItem; + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportUpdateRequest.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportUpdateRequest.java new file mode 100644 index 000000000000..63cc20b0fdea --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportUpdateRequest.java @@ -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 com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Import update input metadata. + */ +@Fluent +public final class ImportUpdateRequest implements JsonSerializable { + /* + * Import update input metadata. + */ + @Generated + private final List importUpdateInput; + + /* + * Whether to enable anti-malware scan of the imported update payload files. + */ + @Generated + private Boolean enableScan; + + /** + * Creates an instance of ImportUpdateRequest class. + * + * @param importUpdateInput the importUpdateInput value to set. + */ + @Generated + public ImportUpdateRequest(List importUpdateInput) { + this.importUpdateInput = importUpdateInput; + } + + /** + * Get the importUpdateInput property: Import update input metadata. + * + * @return the importUpdateInput value. + */ + @Generated + public List getImportUpdateInput() { + return this.importUpdateInput; + } + + /** + * Get the enableScan property: Whether to enable anti-malware scan of the imported update payload files. + * + * @return the enableScan value. + */ + @Generated + public Boolean isEnableScan() { + return this.enableScan; + } + + /** + * Set the enableScan property: Whether to enable anti-malware scan of the imported update payload files. + * + * @param enableScan the enableScan value to set. + * @return the ImportUpdateRequest object itself. + */ + @Generated + public ImportUpdateRequest setEnableScan(Boolean enableScan) { + this.enableScan = enableScan; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("importUpdateInput", this.importUpdateInput, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("enableScan", this.enableScan); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImportUpdateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImportUpdateRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ImportUpdateRequest. + */ + @Generated + public static ImportUpdateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List importUpdateInput = null; + Boolean enableScan = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("importUpdateInput".equals(fieldName)) { + importUpdateInput = reader.readArray(reader1 -> ImportUpdateInputItem.fromJson(reader1)); + } else if ("enableScan".equals(fieldName)) { + enableScan = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + ImportUpdateRequest deserializedImportUpdateRequest = new ImportUpdateRequest(importUpdateInput); + deserializedImportUpdateRequest.enableScan = enableScan; + + return deserializedImportUpdateRequest; + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Instructions.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Instructions.java new file mode 100644 index 000000000000..75de25d12cc2 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Instructions.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +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; +import java.util.List; + +/** + * Update install instructions container. + */ +@Immutable +public final class Instructions implements JsonSerializable { + /* + * Collection of installation steps. + */ + @Generated + private final List steps; + + /** + * Creates an instance of Instructions class. + * + * @param steps the steps value to set. + */ + @Generated + private Instructions(List steps) { + this.steps = steps; + } + + /** + * Get the steps property: Collection of installation steps. + * + * @return the steps value. + */ + @Generated + public List getSteps() { + return this.steps; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("steps", this.steps, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Instructions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Instructions if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Instructions. + */ + @Generated + public static Instructions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List steps = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("steps".equals(fieldName)) { + steps = reader.readArray(reader1 -> Step.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new Instructions(steps); + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/OperationState.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/OperationState.java new file mode 100644 index 000000000000..ae3f1dae1b2d --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/OperationState.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum describing allowed operation states. + */ +public final class OperationState extends ExpandableStringEnum { + /** + * The operation has not started. + */ + @Generated + public static final OperationState NOT_STARTED = fromString("NotStarted"); + + /** + * The operation is in progress. + */ + @Generated + public static final OperationState RUNNING = fromString("Running"); + + /** + * The operation has completed successfully. + */ + @Generated + public static final OperationState SUCCEEDED = fromString("Succeeded"); + + /** + * The operation has failed. + */ + @Generated + public static final OperationState FAILED = fromString("Failed"); + + /** + * The operation has been canceled by the user. + */ + @Generated + public static final OperationState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of OperationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public OperationState() { + } + + /** + * Creates or finds a OperationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationState. + */ + @Generated + public static OperationState fromString(String name) { + return fromString(name, OperationState.class); + } + + /** + * Gets known OperationState values. + * + * @return known OperationState values. + */ + @Generated + public static Collection values() { + return values(OperationState.class); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Step.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Step.java new file mode 100644 index 000000000000..f7a39945e3ff --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Step.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Update install instruction step. + */ +@Immutable +public final class Step implements JsonSerializable { + /* + * Step type. + */ + @Generated + private StepType type; + + /* + * Step description. + */ + @Generated + private String description; + + /* + * Identity of handler that will execute this step. Required if step type is + * inline. + */ + @Generated + private String handler; + + /* + * Parameters to be passed to handler during execution. + */ + @Generated + private Map handlerProperties; + + /* + * Collection of file names to be passed to handler during execution. Required if + * step type is inline. + */ + @Generated + private List fileNames; + + /* + * Referenced child update identity. Required if step type is reference. + */ + @Generated + private UpdateId updateId; + + /** + * Creates an instance of Step class. + */ + @Generated + private Step() { + } + + /** + * Get the type property: Step type. + * + * @return the type value. + */ + @Generated + public StepType getType() { + return this.type; + } + + /** + * Get the description property: Step description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Get the handler property: Identity of handler that will execute this step. Required if step type is + * inline. + * + * @return the handler value. + */ + @Generated + public String getHandler() { + return this.handler; + } + + /** + * Get the handlerProperties property: Parameters to be passed to handler during execution. + * + * @return the handlerProperties value. + */ + @Generated + public Map getHandlerProperties() { + return this.handlerProperties; + } + + /** + * Get the fileNames property: Collection of file names to be passed to handler during execution. Required if + * step type is inline. + * + * @return the fileNames value. + */ + @Generated + public List getFileNames() { + return this.fileNames; + } + + /** + * Get the updateId property: Referenced child update identity. Required if step type is reference. + * + * @return the updateId value. + */ + @Generated + public UpdateId getUpdateId() { + return this.updateId; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("handler", this.handler); + jsonWriter.writeMapField("handlerProperties", this.handlerProperties, (writer, element) -> { + if (element == null) { + writer.writeNull(); + } else { + element.writeTo(writer); + } + }); + jsonWriter.writeArrayField("fileNames", this.fileNames, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("updateId", this.updateId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Step from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Step 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 Step. + */ + @Generated + public static Step fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Step deserializedStep = new Step(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedStep.type = StepType.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedStep.description = reader.getString(); + } else if ("handler".equals(fieldName)) { + deserializedStep.handler = reader.getString(); + } else if ("handlerProperties".equals(fieldName)) { + Map handlerProperties = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + deserializedStep.handlerProperties = handlerProperties; + } else if ("fileNames".equals(fieldName)) { + List fileNames = reader.readArray(reader1 -> reader1.getString()); + deserializedStep.fileNames = fileNames; + } else if ("updateId".equals(fieldName)) { + deserializedStep.updateId = UpdateId.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStep; + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/StepType.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/StepType.java new file mode 100644 index 000000000000..4bed5179528e --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/StepType.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Step type. + */ +public final class StepType extends ExpandableStringEnum { + /** + * Step type that performs code execution. + */ + @Generated + public static final StepType INLINE = fromString("inline"); + + /** + * Step type that installs another update. + */ + @Generated + public static final StepType REFERENCE = fromString("reference"); + + /** + * Creates a new instance of StepType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public StepType() { + } + + /** + * Creates or finds a StepType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StepType. + */ + @Generated + public static StepType fromString(String name) { + return fromString(name, StepType.class); + } + + /** + * Gets known StepType values. + * + * @return known StepType values. + */ + @Generated + public static Collection values() { + return values(StepType.class); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Update.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Update.java new file mode 100644 index 000000000000..1c8fdfd27885 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Update.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Update metadata. + */ +@Immutable +public final class Update implements JsonSerializable { + /* + * Update identity. + */ + @Generated + private final UpdateId updateId; + + /* + * Update description specified by creator. + */ + @Generated + private String description; + + /* + * Friendly update name specified by importer. + */ + @Generated + private String friendlyName; + + /* + * Whether the update can be deployed to a device on its own. + */ + @Generated + private Boolean isDeployable; + + /* + * Update type. Deprecated in latest import manifest schema. + */ + @Generated + private String updateType; + + /* + * String interpreted by Device Update client to determine if the update is + * installed on the device. Deprecated in latest import manifest schema. + */ + @Generated + private String installedCriteria; + + /* + * List of update compatibility information. + */ + @Generated + private final List compatibility; + + /* + * Update install instructions. + */ + @Generated + private Instructions instructions; + + /* + * List of update identities that reference this update. + */ + @Generated + private List referencedBy; + + /* + * Update aggregate scan result (calculated from payload file scan results). + */ + @Generated + private String scanResult; + + /* + * Schema version of manifest used to import the update. + */ + @Generated + private final String manifestVersion; + + /* + * Date and time in UTC when the update was imported. + */ + @Generated + private final OffsetDateTime importedDateTime; + + /* + * Date and time in UTC when the update was created. + */ + @Generated + private final OffsetDateTime createdDateTime; + + /* + * Update ETag. + */ + @Generated + private String etag; + + /** + * Creates an instance of Update class. + * + * @param updateId the updateId value to set. + * @param compatibility the compatibility value to set. + * @param manifestVersion the manifestVersion value to set. + * @param importedDateTime the importedDateTime value to set. + * @param createdDateTime the createdDateTime value to set. + */ + @Generated + private Update(UpdateId updateId, List compatibility, String manifestVersion, + OffsetDateTime importedDateTime, OffsetDateTime createdDateTime) { + this.updateId = updateId; + this.compatibility = compatibility; + this.manifestVersion = manifestVersion; + this.importedDateTime = importedDateTime; + this.createdDateTime = createdDateTime; + } + + /** + * Get the updateId property: Update identity. + * + * @return the updateId value. + */ + @Generated + public UpdateId getUpdateId() { + return this.updateId; + } + + /** + * Get the description property: Update description specified by creator. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Get the friendlyName property: Friendly update name specified by importer. + * + * @return the friendlyName value. + */ + @Generated + public String getFriendlyName() { + return this.friendlyName; + } + + /** + * Get the isDeployable property: Whether the update can be deployed to a device on its own. + * + * @return the isDeployable value. + */ + @Generated + public Boolean isDeployable() { + return this.isDeployable; + } + + /** + * Get the updateType property: Update type. Deprecated in latest import manifest schema. + * + * @return the updateType value. + */ + @Generated + public String getUpdateType() { + return this.updateType; + } + + /** + * Get the installedCriteria property: String interpreted by Device Update client to determine if the update is + * installed on the device. Deprecated in latest import manifest schema. + * + * @return the installedCriteria value. + */ + @Generated + public String getInstalledCriteria() { + return this.installedCriteria; + } + + /** + * Get the compatibility property: List of update compatibility information. + * + * @return the compatibility value. + */ + @Generated + public List getCompatibility() { + return this.compatibility; + } + + /** + * Get the instructions property: Update install instructions. + * + * @return the instructions value. + */ + @Generated + public Instructions getInstructions() { + return this.instructions; + } + + /** + * Get the referencedBy property: List of update identities that reference this update. + * + * @return the referencedBy value. + */ + @Generated + public List getReferencedBy() { + return this.referencedBy; + } + + /** + * Get the scanResult property: Update aggregate scan result (calculated from payload file scan results). + * + * @return the scanResult value. + */ + @Generated + public String getScanResult() { + return this.scanResult; + } + + /** + * Get the manifestVersion property: Schema version of manifest used to import the update. + * + * @return the manifestVersion value. + */ + @Generated + public String getManifestVersion() { + return this.manifestVersion; + } + + /** + * Get the importedDateTime property: Date and time in UTC when the update was imported. + * + * @return the importedDateTime value. + */ + @Generated + public OffsetDateTime getImportedDateTime() { + return this.importedDateTime; + } + + /** + * Get the createdDateTime property: Date and time in UTC when the update was created. + * + * @return the createdDateTime value. + */ + @Generated + public OffsetDateTime getCreatedDateTime() { + return this.createdDateTime; + } + + /** + * Get the etag property: Update ETag. + * + * @return the etag value. + */ + @Generated + public String getEtag() { + return this.etag; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("updateId", this.updateId); + jsonWriter.writeArrayField("compatibility", this.compatibility, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("manifestVersion", this.manifestVersion); + jsonWriter.writeStringField("importedDateTime", + this.importedDateTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.importedDateTime)); + jsonWriter.writeStringField("createdDateTime", + this.createdDateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdDateTime)); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeBooleanField("isDeployable", this.isDeployable); + jsonWriter.writeStringField("updateType", this.updateType); + jsonWriter.writeStringField("installedCriteria", this.installedCriteria); + jsonWriter.writeJsonField("instructions", this.instructions); + jsonWriter.writeArrayField("referencedBy", this.referencedBy, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("scanResult", this.scanResult); + jsonWriter.writeStringField("etag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Update from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Update if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Update. + */ + @Generated + public static Update fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateId updateId = null; + List compatibility = null; + String manifestVersion = null; + OffsetDateTime importedDateTime = null; + OffsetDateTime createdDateTime = null; + String description = null; + String friendlyName = null; + Boolean isDeployable = null; + String updateType = null; + String installedCriteria = null; + Instructions instructions = null; + List referencedBy = null; + String scanResult = null; + String etag = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("updateId".equals(fieldName)) { + updateId = UpdateId.fromJson(reader); + } else if ("compatibility".equals(fieldName)) { + compatibility = reader.readArray(reader1 -> Compatibility.fromJson(reader1)); + } else if ("manifestVersion".equals(fieldName)) { + manifestVersion = reader.getString(); + } else if ("importedDateTime".equals(fieldName)) { + importedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdDateTime".equals(fieldName)) { + createdDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + friendlyName = reader.getString(); + } else if ("isDeployable".equals(fieldName)) { + isDeployable = reader.getNullable(JsonReader::getBoolean); + } else if ("updateType".equals(fieldName)) { + updateType = reader.getString(); + } else if ("installedCriteria".equals(fieldName)) { + installedCriteria = reader.getString(); + } else if ("instructions".equals(fieldName)) { + instructions = Instructions.fromJson(reader); + } else if ("referencedBy".equals(fieldName)) { + referencedBy = reader.readArray(reader1 -> UpdateId.fromJson(reader1)); + } else if ("scanResult".equals(fieldName)) { + scanResult = reader.getString(); + } else if ("etag".equals(fieldName)) { + etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + Update deserializedUpdate + = new Update(updateId, compatibility, manifestVersion, importedDateTime, createdDateTime); + deserializedUpdate.description = description; + deserializedUpdate.friendlyName = friendlyName; + deserializedUpdate.isDeployable = isDeployable; + deserializedUpdate.updateType = updateType; + deserializedUpdate.installedCriteria = installedCriteria; + deserializedUpdate.instructions = instructions; + deserializedUpdate.referencedBy = referencedBy; + deserializedUpdate.scanResult = scanResult; + deserializedUpdate.etag = etag; + + return deserializedUpdate; + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFile.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFile.java new file mode 100644 index 000000000000..a93c2366c851 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFile.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Update file metadata. + */ +@Immutable +public final class UpdateFile extends UpdateFileBase { + /* + * File identity, generated by server at import time. + */ + @Generated + private final String fileId; + + /* + * Optional related files metadata used together DownloadHandler metadata to + * download payload file. + */ + @Generated + private List relatedFiles; + + /* + * Optional download handler for utilizing related files to download payload file. + */ + @Generated + private UpdateFileDownloadHandler downloadHandler; + + /* + * File ETag. + */ + @Generated + private String etag; + + /* + * Optional file properties (not consumed by service but pass-through to device). + */ + @Generated + private Map properties; + + /* + * Anti-malware scan details. + */ + @Generated + private String scanDetails; + + /* + * Anti-malware scan result. + */ + @Generated + private String scanResult; + + /* + * File MIME type. + */ + @Generated + private String mimeType; + + /** + * Creates an instance of UpdateFile class. + * + * @param fileName the fileName value to set. + * @param sizeInBytes the sizeInBytes value to set. + * @param hashes the hashes value to set. + * @param fileId the fileId value to set. + */ + @Generated + private UpdateFile(String fileName, long sizeInBytes, Map hashes, String fileId) { + super(fileName, sizeInBytes, hashes); + this.fileId = fileId; + } + + /** + * Get the fileId property: File identity, generated by server at import time. + * + * @return the fileId value. + */ + @Generated + public String getFileId() { + return this.fileId; + } + + /** + * Get the relatedFiles property: Optional related files metadata used together DownloadHandler metadata to + * download payload file. + * + * @return the relatedFiles value. + */ + @Generated + public List getRelatedFiles() { + return this.relatedFiles; + } + + /** + * Get the downloadHandler property: Optional download handler for utilizing related files to download payload file. + * + * @return the downloadHandler value. + */ + @Generated + public UpdateFileDownloadHandler getDownloadHandler() { + return this.downloadHandler; + } + + /** + * Get the etag property: File ETag. + * + * @return the etag value. + */ + @Generated + public String getEtag() { + return this.etag; + } + + /** + * Get the properties property: Optional file properties (not consumed by service but pass-through to device). + * + * @return the properties value. + */ + @Generated + @Override + public Map getProperties() { + return this.properties; + } + + /** + * Get the scanDetails property: Anti-malware scan details. + * + * @return the scanDetails value. + */ + @Generated + @Override + public String getScanDetails() { + return this.scanDetails; + } + + /** + * Get the scanResult property: Anti-malware scan result. + * + * @return the scanResult value. + */ + @Generated + @Override + public String getScanResult() { + return this.scanResult; + } + + /** + * Get the mimeType property: File MIME type. + * + * @return the mimeType value. + */ + @Generated + @Override + public String getMimeType() { + return this.mimeType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fileName", getFileName()); + jsonWriter.writeLongField("sizeInBytes", getSizeInBytes()); + jsonWriter.writeMapField("hashes", getHashes(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("mimeType", getMimeType()); + jsonWriter.writeStringField("scanResult", getScanResult()); + jsonWriter.writeStringField("scanDetails", getScanDetails()); + jsonWriter.writeMapField("properties", getProperties(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("fileId", this.fileId); + jsonWriter.writeArrayField("relatedFiles", this.relatedFiles, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("downloadHandler", this.downloadHandler); + jsonWriter.writeStringField("etag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateFile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateFile if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UpdateFile. + */ + @Generated + public static UpdateFile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String fileName = null; + long sizeInBytes = 0L; + Map hashes = null; + String mimeType = null; + String scanResult = null; + String scanDetails = null; + Map properties = null; + String fileId = null; + List relatedFiles = null; + UpdateFileDownloadHandler downloadHandler = null; + String etag = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fileName".equals(fieldName)) { + fileName = reader.getString(); + } else if ("sizeInBytes".equals(fieldName)) { + sizeInBytes = reader.getLong(); + } else if ("hashes".equals(fieldName)) { + hashes = reader.readMap(reader1 -> reader1.getString()); + } else if ("mimeType".equals(fieldName)) { + mimeType = reader.getString(); + } else if ("scanResult".equals(fieldName)) { + scanResult = reader.getString(); + } else if ("scanDetails".equals(fieldName)) { + scanDetails = reader.getString(); + } else if ("properties".equals(fieldName)) { + properties = reader.readMap(reader1 -> reader1.getString()); + } else if ("fileId".equals(fieldName)) { + fileId = reader.getString(); + } else if ("relatedFiles".equals(fieldName)) { + relatedFiles = reader.readArray(reader1 -> UpdateFileBase.fromJson(reader1)); + } else if ("downloadHandler".equals(fieldName)) { + downloadHandler = UpdateFileDownloadHandler.fromJson(reader); + } else if ("etag".equals(fieldName)) { + etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + UpdateFile deserializedUpdateFile = new UpdateFile(fileName, sizeInBytes, hashes, fileId); + deserializedUpdateFile.mimeType = mimeType; + deserializedUpdateFile.scanResult = scanResult; + deserializedUpdateFile.scanDetails = scanDetails; + deserializedUpdateFile.properties = properties; + deserializedUpdateFile.relatedFiles = relatedFiles; + deserializedUpdateFile.downloadHandler = downloadHandler; + deserializedUpdateFile.etag = etag; + + return deserializedUpdateFile; + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFileBase.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFileBase.java new file mode 100644 index 000000000000..7cd17da8ea3a --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFileBase.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +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; +import java.util.Map; + +/** + * Update file basic metadata. + */ +@Immutable +public class UpdateFileBase implements JsonSerializable { + /* + * File name. + */ + @Generated + private final String fileName; + + /* + * File size in number of bytes. + */ + @Generated + private final long sizeInBytes; + + /* + * Mapping of hashing algorithm to base64 encoded hash values. + */ + @Generated + private final Map hashes; + + /* + * File MIME type. + */ + @Generated + private String mimeType; + + /* + * Anti-malware scan result. + */ + @Generated + private String scanResult; + + /* + * Anti-malware scan details. + */ + @Generated + private String scanDetails; + + /* + * Optional file properties (not consumed by service but pass-through to device). + */ + @Generated + private Map properties; + + /** + * Creates an instance of UpdateFileBase class. + * + * @param fileName the fileName value to set. + * @param sizeInBytes the sizeInBytes value to set. + * @param hashes the hashes value to set. + */ + @Generated + protected UpdateFileBase(String fileName, long sizeInBytes, Map hashes) { + this.fileName = fileName; + this.sizeInBytes = sizeInBytes; + this.hashes = hashes; + } + + /** + * Get the fileName property: File name. + * + * @return the fileName value. + */ + @Generated + public String getFileName() { + return this.fileName; + } + + /** + * Get the sizeInBytes property: File size in number of bytes. + * + * @return the sizeInBytes value. + */ + @Generated + public long getSizeInBytes() { + return this.sizeInBytes; + } + + /** + * Get the hashes property: Mapping of hashing algorithm to base64 encoded hash values. + * + * @return the hashes value. + */ + @Generated + public Map getHashes() { + return this.hashes; + } + + /** + * Get the mimeType property: File MIME type. + * + * @return the mimeType value. + */ + @Generated + public String getMimeType() { + return this.mimeType; + } + + /** + * Set the mimeType property: File MIME type. + * + * @param mimeType the mimeType value to set. + * @return the UpdateFileBase object itself. + */ + @Generated + UpdateFileBase setMimeType(String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get the scanResult property: Anti-malware scan result. + * + * @return the scanResult value. + */ + @Generated + public String getScanResult() { + return this.scanResult; + } + + /** + * Set the scanResult property: Anti-malware scan result. + * + * @param scanResult the scanResult value to set. + * @return the UpdateFileBase object itself. + */ + @Generated + UpdateFileBase setScanResult(String scanResult) { + this.scanResult = scanResult; + return this; + } + + /** + * Get the scanDetails property: Anti-malware scan details. + * + * @return the scanDetails value. + */ + @Generated + public String getScanDetails() { + return this.scanDetails; + } + + /** + * Set the scanDetails property: Anti-malware scan details. + * + * @param scanDetails the scanDetails value to set. + * @return the UpdateFileBase object itself. + */ + @Generated + UpdateFileBase setScanDetails(String scanDetails) { + this.scanDetails = scanDetails; + return this; + } + + /** + * Get the properties property: Optional file properties (not consumed by service but pass-through to device). + * + * @return the properties value. + */ + @Generated + public Map getProperties() { + return this.properties; + } + + /** + * Set the properties property: Optional file properties (not consumed by service but pass-through to device). + * + * @param properties the properties value to set. + * @return the UpdateFileBase object itself. + */ + @Generated + UpdateFileBase setProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fileName", this.fileName); + jsonWriter.writeLongField("sizeInBytes", this.sizeInBytes); + jsonWriter.writeMapField("hashes", this.hashes, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("mimeType", this.mimeType); + jsonWriter.writeStringField("scanResult", this.scanResult); + jsonWriter.writeStringField("scanDetails", this.scanDetails); + jsonWriter.writeMapField("properties", this.properties, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateFileBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateFileBase if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UpdateFileBase. + */ + @Generated + public static UpdateFileBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String fileName = null; + long sizeInBytes = 0L; + Map hashes = null; + String mimeType = null; + String scanResult = null; + String scanDetails = null; + Map properties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fileName".equals(fieldName)) { + fileName = reader.getString(); + } else if ("sizeInBytes".equals(fieldName)) { + sizeInBytes = reader.getLong(); + } else if ("hashes".equals(fieldName)) { + hashes = reader.readMap(reader1 -> reader1.getString()); + } else if ("mimeType".equals(fieldName)) { + mimeType = reader.getString(); + } else if ("scanResult".equals(fieldName)) { + scanResult = reader.getString(); + } else if ("scanDetails".equals(fieldName)) { + scanDetails = reader.getString(); + } else if ("properties".equals(fieldName)) { + properties = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + UpdateFileBase deserializedUpdateFileBase = new UpdateFileBase(fileName, sizeInBytes, hashes); + deserializedUpdateFileBase.mimeType = mimeType; + deserializedUpdateFileBase.scanResult = scanResult; + deserializedUpdateFileBase.scanDetails = scanDetails; + deserializedUpdateFileBase.properties = properties; + + return deserializedUpdateFileBase; + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFileDownloadHandler.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFileDownloadHandler.java new file mode 100644 index 000000000000..ddde26b8416e --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFileDownloadHandler.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Download handler for utilizing related files to download payload file. + */ +@Immutable +public final class UpdateFileDownloadHandler implements JsonSerializable { + /* + * Download handler identifier. + */ + @Generated + private final String id; + + /** + * Creates an instance of UpdateFileDownloadHandler class. + * + * @param id the id value to set. + */ + @Generated + private UpdateFileDownloadHandler(String id) { + this.id = id; + } + + /** + * Get the id property: Download handler identifier. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateFileDownloadHandler from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateFileDownloadHandler if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UpdateFileDownloadHandler. + */ + @Generated + public static UpdateFileDownloadHandler fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new UpdateFileDownloadHandler(id); + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateId.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateId.java new file mode 100644 index 000000000000..5d136f7ddb67 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateId.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Update identifier. + */ +@Immutable +public final class UpdateId implements JsonSerializable { + /* + * Update provider. Must be between 1 and 64 characters and contain only letters, digits, periods, and hyphens. + */ + @Generated + private final String provider; + + /* + * Update name. Must be between 1 and 64 characters and contain only letters, digits, periods, and hyphens. + */ + @Generated + private final String name; + + /* + * Update version as a two- to four-part dot-separated numeric string. + */ + @Generated + private final String version; + + /** + * Creates an instance of UpdateId class. + * + * @param provider the provider value to set. + * @param name the name value to set. + * @param version the version value to set. + */ + @Generated + private UpdateId(String provider, String name, String version) { + this.provider = provider; + this.name = name; + this.version = version; + } + + /** + * Get the provider property: Update provider. Must be between 1 and 64 characters and contain only letters, digits, + * periods, and hyphens. + * + * @return the provider value. + */ + @Generated + public String getProvider() { + return this.provider; + } + + /** + * Get the name property: Update name. Must be between 1 and 64 characters and contain only letters, digits, + * periods, and hyphens. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the version property: Update version as a two- to four-part dot-separated numeric string. + * + * @return the version value. + */ + @Generated + public String getVersion() { + return this.version; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provider", this.provider); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("version", this.version); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateId from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateId if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UpdateId. + */ + @Generated + public static UpdateId fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String provider = null; + String name = null; + String version = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + provider = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("version".equals(fieldName)) { + version = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new UpdateId(provider, name, version); + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateInfo.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateInfo.java new file mode 100644 index 000000000000..5ef4574e4d81 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateInfo.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * Update information. + */ +@Immutable +public final class UpdateInfo implements JsonSerializable { + /* + * Update identifier. + */ + @Generated + private final UpdateId updateId; + + /* + * Update description. + */ + @Generated + private String description; + + /* + * Friendly update name. + */ + @Generated + private String friendlyName; + + /** + * Creates an instance of UpdateInfo class. + * + * @param updateId the updateId value to set. + */ + @Generated + private UpdateInfo(UpdateId updateId) { + this.updateId = updateId; + } + + /** + * Get the updateId property: Update identifier. + * + * @return the updateId value. + */ + @Generated + public UpdateId getUpdateId() { + return this.updateId; + } + + /** + * Get the description property: Update description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Get the friendlyName property: Friendly update name. + * + * @return the friendlyName value. + */ + @Generated + public String getFriendlyName() { + return this.friendlyName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("updateId", this.updateId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateInfo if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UpdateInfo. + */ + @Generated + public static UpdateInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateId updateId = null; + String description = null; + String friendlyName = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("updateId".equals(fieldName)) { + updateId = UpdateId.fromJson(reader); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + friendlyName = reader.getString(); + } else { + reader.skipChildren(); + } + } + UpdateInfo deserializedUpdateInfo = new UpdateInfo(updateId); + deserializedUpdateInfo.description = description; + deserializedUpdateInfo.friendlyName = friendlyName; + + return deserializedUpdateInfo; + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateOperation.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateOperation.java new file mode 100644 index 000000000000..3a5d9b7c3907 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateOperation.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Operation metadata. + */ +@Immutable +public final class UpdateOperation implements JsonSerializable { + /* + * Operation Id. + */ + @Generated + private final String operationId; + + /* + * Operation status. + */ + @Generated + private final OperationState status; + + /* + * The update being imported or deleted. For import, this property will only be + * populated after import manifest is processed successfully. + */ + @Generated + private UpdateInfo update; + + /* + * Location of the imported update when operation is successful. + */ + @Generated + private String resourceLocation; + + /* + * Operation error encountered, if any. + */ + @Generated + private ResponseError error; + + /* + * Operation correlation identity that can used by Microsoft Support for + * troubleshooting. + */ + @Generated + private String traceId; + + /* + * Date and time in UTC when the operation status was last updated. + */ + @Generated + private final OffsetDateTime lastActionDateTime; + + /* + * Date and time in UTC when the operation was created. + */ + @Generated + private final OffsetDateTime createdDateTime; + + /* + * Operation ETag. + */ + @Generated + private String etag; + + /** + * Creates an instance of UpdateOperation class. + * + * @param operationId the operationId value to set. + * @param status the status value to set. + * @param lastActionDateTime the lastActionDateTime value to set. + * @param createdDateTime the createdDateTime value to set. + */ + @Generated + private UpdateOperation(String operationId, OperationState status, OffsetDateTime lastActionDateTime, + OffsetDateTime createdDateTime) { + this.operationId = operationId; + this.status = status; + this.lastActionDateTime = lastActionDateTime; + this.createdDateTime = createdDateTime; + } + + /** + * Get the operationId property: Operation Id. + * + * @return the operationId value. + */ + @Generated + public String getOperationId() { + return this.operationId; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + @Generated + public OperationState getStatus() { + return this.status; + } + + /** + * Get the update property: The update being imported or deleted. For import, this property will only be + * populated after import manifest is processed successfully. + * + * @return the update value. + */ + @Generated + public UpdateInfo getUpdate() { + return this.update; + } + + /** + * Get the resourceLocation property: Location of the imported update when operation is successful. + * + * @return the resourceLocation value. + */ + @Generated + public String getResourceLocation() { + return this.resourceLocation; + } + + /** + * Get the error property: Operation error encountered, if any. + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } + + /** + * Get the traceId property: Operation correlation identity that can used by Microsoft Support for + * troubleshooting. + * + * @return the traceId value. + */ + @Generated + public String getTraceId() { + return this.traceId; + } + + /** + * Get the lastActionDateTime property: Date and time in UTC when the operation status was last updated. + * + * @return the lastActionDateTime value. + */ + @Generated + public OffsetDateTime getLastActionDateTime() { + return this.lastActionDateTime; + } + + /** + * Get the createdDateTime property: Date and time in UTC when the operation was created. + * + * @return the createdDateTime value. + */ + @Generated + public OffsetDateTime getCreatedDateTime() { + return this.createdDateTime; + } + + /** + * Get the etag property: Operation ETag. + * + * @return the etag value. + */ + @Generated + public String getEtag() { + return this.etag; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("lastActionDateTime", + this.lastActionDateTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastActionDateTime)); + jsonWriter.writeStringField("createdDateTime", + this.createdDateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdDateTime)); + jsonWriter.writeJsonField("update", this.update); + jsonWriter.writeStringField("resourceLocation", this.resourceLocation); + jsonWriter.writeJsonField("error", this.error); + jsonWriter.writeStringField("traceId", this.traceId); + jsonWriter.writeStringField("etag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateOperation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateOperation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UpdateOperation. + */ + @Generated + public static UpdateOperation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String operationId = null; + OperationState status = null; + OffsetDateTime lastActionDateTime = null; + OffsetDateTime createdDateTime = null; + UpdateInfo update = null; + String resourceLocation = null; + ResponseError error = null; + String traceId = null; + String etag = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + status = OperationState.fromString(reader.getString()); + } else if ("lastActionDateTime".equals(fieldName)) { + lastActionDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdDateTime".equals(fieldName)) { + createdDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("update".equals(fieldName)) { + update = UpdateInfo.fromJson(reader); + } else if ("resourceLocation".equals(fieldName)) { + resourceLocation = reader.getString(); + } else if ("error".equals(fieldName)) { + error = ResponseError.fromJson(reader); + } else if ("traceId".equals(fieldName)) { + traceId = reader.getString(); + } else if ("etag".equals(fieldName)) { + etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + UpdateOperation deserializedUpdateOperation + = new UpdateOperation(operationId, status, lastActionDateTime, createdDateTime); + deserializedUpdateOperation.update = update; + deserializedUpdateOperation.resourceLocation = resourceLocation; + deserializedUpdateOperation.error = error; + deserializedUpdateOperation.traceId = traceId; + deserializedUpdateOperation.etag = etag; + + return deserializedUpdateOperation; + }); + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/package-info.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/package-info.java new file mode 100644 index 000000000000..76e35cba0035 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for DeviceRegistrySoftwareUpdateClient. + * Software Update for Device Registry is an Azure service that enables customers to publish updates for their IoT + * devices to the cloud, and then deploy that update to their devices (approve updates to groups of devices managed and + * provisioned in Device Registry). It leverages the proven security and reliability of the Windows Update platform, + * optimized for IoT devices. It works globally and knows when and how to update devices, enabling customers to focus on + * their business goals and let Software Update for Device Registry handle the updates. + */ +package com.azure.iot.deviceregistry.softwareupdate.models; diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/package-info.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/package-info.java new file mode 100644 index 000000000000..38ec9a636da9 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/com/azure/iot/deviceregistry/softwareupdate/package-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for DeviceRegistrySoftwareUpdateClient. + * Software Update for Device Registry is an Azure service that enables customers to publish updates for their IoT + * devices to the cloud, and then deploy that update to their devices (approve updates to groups of devices managed and + * provisioned in Device Registry). It leverages the proven security and reliability of the Windows Update platform, + * optimized for IoT devices. It works globally and knows when and how to update devices, enabling customers to focus on + * their business goals and let Software Update for Device Registry handle the updates. + */ +package com.azure.iot.deviceregistry.softwareupdate; diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/module-info.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/module-info.java new file mode 100644 index 000000000000..1d98ee6bb6f9 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/java/module-info.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.iot.deviceregistry.softwareupdate { + requires transitive com.azure.core; + + exports com.azure.iot.deviceregistry.softwareupdate; + exports com.azure.iot.deviceregistry.softwareupdate.models; + + opens com.azure.iot.deviceregistry.softwareupdate.models to com.azure.core; +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/resources/META-INF/azure-iot-deviceregistry-softwareupdate_metadata.json b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/resources/META-INF/azure-iot-deviceregistry-softwareupdate_metadata.json new file mode 100644 index 000000000000..7f3615d66ff6 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/resources/META-INF/azure-iot-deviceregistry-softwareupdate_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"DeviceRegistrySoftwareUpdateClient":"2026-11-02-preview"},"crossLanguagePackageId":"DeviceRegistrySoftwareUpdateClient","crossLanguageVersion":"9f048e962491","crossLanguageDefinitions":{"com.azure.iot.deviceregistry.softwareupdate.DeviceClassesAsyncClient":"DeviceRegistrySoftwareUpdateClient.DeviceClasses","com.azure.iot.deviceregistry.softwareupdate.DeviceClassesAsyncClient.delete":"DeviceRegistrySoftwareUpdateClient.DeviceClasses.delete","com.azure.iot.deviceregistry.softwareupdate.DeviceClassesAsyncClient.deleteWithResponse":"DeviceRegistrySoftwareUpdateClient.DeviceClasses.delete","com.azure.iot.deviceregistry.softwareupdate.DeviceClassesAsyncClient.getDeviceClass":"DeviceRegistrySoftwareUpdateClient.DeviceClasses.getDeviceClass","com.azure.iot.deviceregistry.softwareupdate.DeviceClassesAsyncClient.getDeviceClassWithResponse":"DeviceRegistrySoftwareUpdateClient.DeviceClasses.getDeviceClass","com.azure.iot.deviceregistry.softwareupdate.DeviceClassesAsyncClient.list":"DeviceRegistrySoftwareUpdateClient.DeviceClasses.list","com.azure.iot.deviceregistry.softwareupdate.DeviceClassesClient":"DeviceRegistrySoftwareUpdateClient.DeviceClasses","com.azure.iot.deviceregistry.softwareupdate.DeviceClassesClient.delete":"DeviceRegistrySoftwareUpdateClient.DeviceClasses.delete","com.azure.iot.deviceregistry.softwareupdate.DeviceClassesClient.deleteWithResponse":"DeviceRegistrySoftwareUpdateClient.DeviceClasses.delete","com.azure.iot.deviceregistry.softwareupdate.DeviceClassesClient.getDeviceClass":"DeviceRegistrySoftwareUpdateClient.DeviceClasses.getDeviceClass","com.azure.iot.deviceregistry.softwareupdate.DeviceClassesClient.getDeviceClassWithResponse":"DeviceRegistrySoftwareUpdateClient.DeviceClasses.getDeviceClass","com.azure.iot.deviceregistry.softwareupdate.DeviceClassesClient.list":"DeviceRegistrySoftwareUpdateClient.DeviceClasses.list","com.azure.iot.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateClientBuilder":"DeviceRegistrySoftwareUpdateClient","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient":"DeviceRegistrySoftwareUpdateClient","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.beginDeleteUpdate":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.deleteUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.beginDeleteUpdateWithModel":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.deleteUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.beginImportUpdate":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.importUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.beginImportUpdateWithModel":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.importUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.getFile":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getFile","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.getFileWithResponse":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getFile","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.getOperationStatus":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getOperationStatus","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.getOperationStatusWithResponse":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getOperationStatus","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.getUpdate":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.getUpdateWithResponse":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.listFiles":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listFiles","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.listNames":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listNames","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.listOperationStatuses":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listOperationStatuses","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.listProviders":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listProviders","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.listUpdates":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listUpdates","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateAsyncClient.listVersions":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listVersions","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient":"DeviceRegistrySoftwareUpdateClient","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.beginDeleteUpdate":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.deleteUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.beginDeleteUpdateWithModel":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.deleteUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.beginImportUpdate":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.importUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.beginImportUpdateWithModel":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.importUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.getFile":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getFile","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.getFileWithResponse":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getFile","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.getOperationStatus":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getOperationStatus","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.getOperationStatusWithResponse":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getOperationStatus","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.getUpdate":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.getUpdateWithResponse":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.getUpdate","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.listFiles":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listFiles","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.listNames":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listNames","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.listOperationStatuses":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listOperationStatuses","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.listProviders":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listProviders","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.listUpdates":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listUpdates","com.azure.iot.deviceregistry.softwareupdate.SoftwareUpdateClient.listVersions":"DeviceRegistrySoftwareUpdateClient.SoftwareUpdateOperationGroup.listVersions","com.azure.iot.deviceregistry.softwareupdate.models.BestCompatibleUpdate":"DeviceRegistrySoftwareUpdateClient.BestCompatibleUpdate","com.azure.iot.deviceregistry.softwareupdate.models.Compatibility":"DeviceRegistrySoftwareUpdateClient.Compatibility","com.azure.iot.deviceregistry.softwareupdate.models.DeviceClass":"DeviceRegistrySoftwareUpdateClient.DeviceClass","com.azure.iot.deviceregistry.softwareupdate.models.DeviceClassProperties":"DeviceRegistrySoftwareUpdateClient.DeviceClassProperties","com.azure.iot.deviceregistry.softwareupdate.models.FileImportMetadata":"DeviceRegistrySoftwareUpdateClient.FileImportMetadata","com.azure.iot.deviceregistry.softwareupdate.models.ImportManifestMetadata":"DeviceRegistrySoftwareUpdateClient.ImportManifestMetadata","com.azure.iot.deviceregistry.softwareupdate.models.ImportUpdateInputItem":"DeviceRegistrySoftwareUpdateClient.ImportUpdateInputItem","com.azure.iot.deviceregistry.softwareupdate.models.ImportUpdateRequest":"DeviceRegistrySoftwareUpdateClient.ImportUpdateRequest","com.azure.iot.deviceregistry.softwareupdate.models.Instructions":"DeviceRegistrySoftwareUpdateClient.Instructions","com.azure.iot.deviceregistry.softwareupdate.models.OperationState":"Azure.Core.Foundations.OperationState","com.azure.iot.deviceregistry.softwareupdate.models.Step":"DeviceRegistrySoftwareUpdateClient.Step","com.azure.iot.deviceregistry.softwareupdate.models.StepType":"DeviceRegistrySoftwareUpdateClient.StepType","com.azure.iot.deviceregistry.softwareupdate.models.Update":"DeviceRegistrySoftwareUpdateClient.Update","com.azure.iot.deviceregistry.softwareupdate.models.UpdateFile":"DeviceRegistrySoftwareUpdateClient.UpdateFile","com.azure.iot.deviceregistry.softwareupdate.models.UpdateFileBase":"DeviceRegistrySoftwareUpdateClient.UpdateFileBase","com.azure.iot.deviceregistry.softwareupdate.models.UpdateFileDownloadHandler":"DeviceRegistrySoftwareUpdateClient.UpdateFileDownloadHandler","com.azure.iot.deviceregistry.softwareupdate.models.UpdateId":"DeviceRegistrySoftwareUpdateClient.UpdateId","com.azure.iot.deviceregistry.softwareupdate.models.UpdateInfo":"DeviceRegistrySoftwareUpdateClient.UpdateInfo","com.azure.iot.deviceregistry.softwareupdate.models.UpdateOperation":"DeviceRegistrySoftwareUpdateClient.UpdateOperation"},"generatedFiles":["src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceClassesAsyncClient.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceClassesClient.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateClientBuilder.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateServiceVersion.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/SoftwareUpdateAsyncClient.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/SoftwareUpdateClient.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/DeviceClassesImpl.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateClientImpl.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/SoftwareUpdatesImpl.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/implementation/package-info.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/BestCompatibleUpdate.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Compatibility.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/DeviceClass.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/DeviceClassProperties.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/FileImportMetadata.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportManifestMetadata.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportUpdateInputItem.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/ImportUpdateRequest.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Instructions.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/OperationState.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Step.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/StepType.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/Update.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFile.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFileBase.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateFileDownloadHandler.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateId.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateInfo.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/UpdateOperation.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/models/package-info.java","src/main/java/com/azure/iot/deviceregistry/softwareupdate/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/resources/azure-iot-deviceregistry-softwareupdate.properties b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/resources/azure-iot-deviceregistry-softwareupdate.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/main/resources/azure-iot-deviceregistry-softwareupdate.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/samples/java/com/azure/iot/deviceregistry/softwareupdate/ReadmeSamples.java b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/samples/java/com/azure/iot/deviceregistry/softwareupdate/ReadmeSamples.java new file mode 100644 index 000000000000..1c29e20b75ac --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/src/samples/java/com/azure/iot/deviceregistry/softwareupdate/ReadmeSamples.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.iot.deviceregistry.softwareupdate; + +public final class ReadmeSamples { + public void readmeSamples() { + // BEGIN: com.azure.iot.deviceregistry.softwareupdate.readme + // END: com.azure.iot.deviceregistry.softwareupdate.readme + } +} diff --git a/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/tsp-location.yaml b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/tsp-location.yaml new file mode 100644 index 000000000000..680bf4edb1f5 --- /dev/null +++ b/sdk/deviceregistry/azure-iot-deviceregistry-softwareupdate/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/deviceupdate/data-plane/sudeviceregistry +commit: be4f14d4492f9f60eb6cabf3a93cce8a7cef803c +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/deviceregistry/ci.yml b/sdk/deviceregistry/ci.yml index 5150934cd43d..29bdc17ead81 100644 --- a/sdk/deviceregistry/ci.yml +++ b/sdk/deviceregistry/ci.yml @@ -34,6 +34,10 @@ parameters: displayName: azure-resourcemanager-deviceregistry type: boolean default: false + - name: release_azureiotdeviceregistrysoftwareupdate + displayName: azure-iot-deviceregistry-softwareupdate + type: boolean + default: true extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -44,3 +48,7 @@ extends: groupId: com.azure.resourcemanager safeName: azureresourcemanagerdeviceregistry releaseInBatch: ${{ parameters.release_azureresourcemanagerdeviceregistry }} + - name: azure-iot-deviceregistry-softwareupdate + groupId: com.azure + safeName: azureiotdeviceregistrysoftwareupdate + releaseInBatch: ${{ parameters.release_azureiotdeviceregistrysoftwareupdate }} diff --git a/sdk/deviceregistry/cspell.yaml b/sdk/deviceregistry/cspell.yaml new file mode 100644 index 000000000000..7b11f72eaeb0 --- /dev/null +++ b/sdk/deviceregistry/cspell.yaml @@ -0,0 +1,4 @@ +import: + - ../../.vscode/cspell.json +words: + - sudeviceregistry diff --git a/sdk/deviceregistry/pom.xml b/sdk/deviceregistry/pom.xml index ebb08fe36d35..0f64fc5f074b 100644 --- a/sdk/deviceregistry/pom.xml +++ b/sdk/deviceregistry/pom.xml @@ -10,6 +10,7 @@ 1.0.0 + azure-iot-deviceregistry-softwareupdate azure-resourcemanager-deviceregistry