diff --git a/sdk/imds/azure-imds-imds/CHANGELOG.md b/sdk/imds/azure-imds-imds/CHANGELOG.md
new file mode 100644
index 0000000000000..b3f9d62cdc1c3
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/CHANGELOG.md
@@ -0,0 +1,13 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+- Azure InstanceMetadataClient client library for Java. This package contains Microsoft Azure InstanceMetadataClient client library.
+
+### Features Added
+
+### Breaking Changes
+
+### Bugs Fixed
+
+### Other Changes
diff --git a/sdk/imds/azure-imds-imds/README.md b/sdk/imds/azure-imds-imds/README.md
new file mode 100644
index 0000000000000..586078957872b
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/README.md
@@ -0,0 +1,63 @@
+# Azure InstanceMetadataClient client library for Java
+
+Azure InstanceMetadataClient client library for Java.
+
+This package contains Microsoft Azure InstanceMetadataClient 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-imds-imds;current})
+```xml
+
+ com.azure
+ azure-imds-imds
+ 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.imds.imds.readme
+```
+
+## 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://docs.microsoft.com/java/azure/jdk/
+[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/imds/azure-imds-imds/pom.xml b/sdk/imds/azure-imds-imds/pom.xml
new file mode 100644
index 0000000000000..8dfeba06ba37d
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/pom.xml
@@ -0,0 +1,76 @@
+
+ 4.0.0
+
+ com.azure
+ azure-client-sdk-parent
+ 1.7.0
+ ../../parents/azure-client-sdk-parent
+
+
+ com.azure
+ azure-imds-imds
+ 1.0.0-beta.1
+ jar
+
+ Microsoft Azure SDK for InstanceMetadataClient Management
+ This package contains Microsoft Azure InstanceMetadataClient 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
+ true
+ false
+
+
+
+
+
+ com.azure
+ azure-core
+ 1.23.0
+
+
+ com.azure
+ azure-core-http-netty
+ 1.11.3
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ 5.7.2
+ test
+
+
+ com.azure
+ azure-core-test
+ 1.7.4
+ test
+
+
+ com.azure
+ azure-identity
+ 1.4.2
+ test
+
+
+
diff --git a/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/IdentityAsyncClient.java b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/IdentityAsyncClient.java
new file mode 100644
index 0000000000000..59ed553884670
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/IdentityAsyncClient.java
@@ -0,0 +1,108 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds;
+
+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.HttpResponseException;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.imds.imds.implementation.IdentitiesImpl;
+import reactor.core.publisher.Mono;
+
+/** Initializes a new instance of the asynchronous InstanceMetadataClient type. */
+@ServiceClient(builder = InstanceMetadataClientBuilder.class, isAsync = true)
+public final class IdentityAsyncClient {
+ @Generated private final IdentitiesImpl serviceClient;
+
+ /**
+ * Initializes an instance of Identities client.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ IdentityAsyncClient(IdentitiesImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Get a Token from Azure AD.
+ *
+ *
Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * resource | String | Yes | This is the urlencoded identifier URI of the sink resource for the requested Azure AD token. The resulting token contains the corresponding aud for this resource. |
+ * apiVersion | String | Yes | Api Version |
+ * clientId | String | No | This identifies, by Azure AD client id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with object_id and msi_res_id. |
+ * objectId | String | No | This identifies, by Azure AD object id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and msi_res_id. |
+ * msiResId | String | No | This identifies, by urlencoded ARM resource id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and object_id. |
+ * authority | String | No | This indicates the authority to request AAD tokens from. Defaults to the known authority of the identity to be used. |
+ * bypassCache | String | No | If provided, the value must be 'true'. This indicates to the server that the token must be retrieved from Azure AD and cannot be retrieved from an internal cache. |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return a Token from Azure AD.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getTokenWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.getTokenWithResponseAsync(requestOptions);
+ }
+
+ /**
+ * Get information about AAD Metadata.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * apiVersion | String | Yes | Api Version |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return information about AAD Metadata.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getInfoWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.getInfoWithResponseAsync(requestOptions);
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/IdentityClient.java b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/IdentityClient.java
new file mode 100644
index 0000000000000..9f3c446a45a86
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/IdentityClient.java
@@ -0,0 +1,107 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds;
+
+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.HttpResponseException;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.imds.imds.implementation.IdentitiesImpl;
+
+/** Initializes a new instance of the synchronous InstanceMetadataClient type. */
+@ServiceClient(builder = InstanceMetadataClientBuilder.class)
+public final class IdentityClient {
+ @Generated private final IdentitiesImpl serviceClient;
+
+ /**
+ * Initializes an instance of Identities client.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ IdentityClient(IdentitiesImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Get a Token from Azure AD.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * resource | String | Yes | This is the urlencoded identifier URI of the sink resource for the requested Azure AD token. The resulting token contains the corresponding aud for this resource. |
+ * apiVersion | String | Yes | Api Version |
+ * clientId | String | No | This identifies, by Azure AD client id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with object_id and msi_res_id. |
+ * objectId | String | No | This identifies, by Azure AD object id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and msi_res_id. |
+ * msiResId | String | No | This identifies, by urlencoded ARM resource id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and object_id. |
+ * authority | String | No | This indicates the authority to request AAD tokens from. Defaults to the known authority of the identity to be used. |
+ * bypassCache | String | No | If provided, the value must be 'true'. This indicates to the server that the token must be retrieved from Azure AD and cannot be retrieved from an internal cache. |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return a Token from Azure AD.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getTokenWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.getTokenWithResponse(requestOptions);
+ }
+
+ /**
+ * Get information about AAD Metadata.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * apiVersion | String | Yes | Api Version |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return information about AAD Metadata.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getInfoWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.getInfoWithResponse(requestOptions);
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstanceMetadataClientBuilder.java b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstanceMetadataClientBuilder.java
new file mode 100644
index 0000000000000..834609820a407
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstanceMetadataClientBuilder.java
@@ -0,0 +1,319 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds;
+
+import com.azure.core.annotation.ServiceClientBuilder;
+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.AddHeadersPolicy;
+import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
+import com.azure.core.http.policy.CookiePolicy;
+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.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.serializer.JacksonAdapter;
+import com.azure.imds.imds.implementation.InstanceMetadataClientImpl;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/** A builder for creating a new instance of the InstanceMetadataClient type. */
+@ServiceClientBuilder(
+ serviceClients = {
+ InstancesClient.class,
+ IdentityClient.class,
+ InstancesAsyncClient.class,
+ IdentityAsyncClient.class
+ })
+public final class InstanceMetadataClientBuilder {
+ private static final String SDK_NAME = "name";
+
+ private static final String SDK_VERSION = "version";
+
+ static final String[] DEFAULT_SCOPES = new String[] {"https://imds.azure.com/.default"};
+
+ private final Map properties = new HashMap<>();
+
+ /** Create an instance of the InstanceMetadataClientBuilder. */
+ public InstanceMetadataClientBuilder() {
+ this.pipelinePolicies = new ArrayList<>();
+ }
+
+ /*
+ * server parameter
+ */
+ private String host;
+
+ /**
+ * Sets server parameter.
+ *
+ * @param host the host value.
+ * @return the InstanceMetadataClientBuilder.
+ */
+ public InstanceMetadataClientBuilder host(String host) {
+ this.host = host;
+ return this;
+ }
+
+ /*
+ * Service version
+ */
+ private InstanceMetadataClientServiceVersion serviceVersion;
+
+ /**
+ * Sets Service version.
+ *
+ * @param serviceVersion the serviceVersion value.
+ * @return the InstanceMetadataClientBuilder.
+ */
+ public InstanceMetadataClientBuilder serviceVersion(InstanceMetadataClientServiceVersion serviceVersion) {
+ this.serviceVersion = serviceVersion;
+ return this;
+ }
+
+ /*
+ * The HTTP pipeline to send requests through
+ */
+ private HttpPipeline pipeline;
+
+ /**
+ * Sets The HTTP pipeline to send requests through.
+ *
+ * @param pipeline the pipeline value.
+ * @return the InstanceMetadataClientBuilder.
+ */
+ public InstanceMetadataClientBuilder pipeline(HttpPipeline pipeline) {
+ this.pipeline = pipeline;
+ return this;
+ }
+
+ /*
+ * The HTTP client used to send the request.
+ */
+ private HttpClient httpClient;
+
+ /**
+ * Sets The HTTP client used to send the request.
+ *
+ * @param httpClient the httpClient value.
+ * @return the InstanceMetadataClientBuilder.
+ */
+ public InstanceMetadataClientBuilder httpClient(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ return this;
+ }
+
+ /*
+ * The configuration store that is used during construction of the service
+ * client.
+ */
+ private Configuration configuration;
+
+ /**
+ * Sets The configuration store that is used during construction of the service client.
+ *
+ * @param configuration the configuration value.
+ * @return the InstanceMetadataClientBuilder.
+ */
+ public InstanceMetadataClientBuilder configuration(Configuration configuration) {
+ this.configuration = configuration;
+ return this;
+ }
+
+ /*
+ * The TokenCredential used for authentication.
+ */
+ private TokenCredential tokenCredential;
+
+ /**
+ * Sets The TokenCredential used for authentication.
+ *
+ * @param tokenCredential the tokenCredential value.
+ * @return the InstanceMetadataClientBuilder.
+ */
+ public InstanceMetadataClientBuilder credential(TokenCredential tokenCredential) {
+ this.tokenCredential = tokenCredential;
+ return this;
+ }
+
+ /*
+ * The logging configuration for HTTP requests and responses.
+ */
+ private HttpLogOptions httpLogOptions;
+
+ /**
+ * Sets The logging configuration for HTTP requests and responses.
+ *
+ * @param httpLogOptions the httpLogOptions value.
+ * @return the InstanceMetadataClientBuilder.
+ */
+ public InstanceMetadataClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) {
+ this.httpLogOptions = httpLogOptions;
+ return this;
+ }
+
+ /*
+ * The retry policy that will attempt to retry failed requests, if
+ * applicable.
+ */
+ private RetryPolicy retryPolicy;
+
+ /**
+ * Sets The retry policy that will attempt to retry failed requests, if applicable.
+ *
+ * @param retryPolicy the retryPolicy value.
+ * @return the InstanceMetadataClientBuilder.
+ */
+ public InstanceMetadataClientBuilder retryPolicy(RetryPolicy retryPolicy) {
+ this.retryPolicy = retryPolicy;
+ return this;
+ }
+
+ /*
+ * The list of Http pipeline policies to add.
+ */
+ private final List pipelinePolicies;
+
+ /*
+ * The client options such as application ID and custom headers to set on a
+ * request.
+ */
+ private ClientOptions clientOptions;
+
+ /**
+ * Sets The client options such as application ID and custom headers to set on a request.
+ *
+ * @param clientOptions the clientOptions value.
+ * @return the InstanceMetadataClientBuilder.
+ */
+ public InstanceMetadataClientBuilder clientOptions(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ return this;
+ }
+
+ /**
+ * Adds a custom Http pipeline policy.
+ *
+ * @param customPolicy The custom Http pipeline policy to add.
+ * @return the InstanceMetadataClientBuilder.
+ */
+ public InstanceMetadataClientBuilder addPolicy(HttpPipelinePolicy customPolicy) {
+ pipelinePolicies.add(customPolicy);
+ return this;
+ }
+
+ /**
+ * Builds an instance of InstanceMetadataClientImpl with the provided parameters.
+ *
+ * @return an instance of InstanceMetadataClientImpl.
+ */
+ private InstanceMetadataClientImpl buildInnerClient() {
+ if (host == null) {
+ this.host = "https://169.254.169.254/metadata";
+ }
+ if (serviceVersion == null) {
+ this.serviceVersion = InstanceMetadataClientServiceVersion.getLatest();
+ }
+ if (pipeline == null) {
+ this.pipeline = createHttpPipeline();
+ }
+ InstanceMetadataClientImpl client =
+ new InstanceMetadataClientImpl(
+ pipeline, JacksonAdapter.createDefaultSerializerAdapter(), host, serviceVersion);
+ return client;
+ }
+
+ private HttpPipeline createHttpPipeline() {
+ Configuration buildConfiguration =
+ (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
+ if (httpLogOptions == null) {
+ httpLogOptions = new HttpLogOptions();
+ }
+ if (clientOptions == null) {
+ clientOptions = new ClientOptions();
+ }
+ List policies = new ArrayList<>();
+ String clientName = properties.getOrDefault(SDK_NAME, "UnknownName");
+ String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion");
+ String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions);
+ policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration));
+ HttpHeaders headers = new HttpHeaders();
+ clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue()));
+ if (headers.getSize() > 0) {
+ policies.add(new AddHeadersPolicy(headers));
+ }
+ policies.addAll(
+ this.pipelinePolicies.stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
+ .collect(Collectors.toList()));
+ HttpPolicyProviders.addBeforeRetryPolicies(policies);
+ policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy);
+ policies.add(new CookiePolicy());
+ if (tokenCredential != null) {
+ policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES));
+ }
+ policies.addAll(
+ this.pipelinePolicies.stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
+ .collect(Collectors.toList()));
+ HttpPolicyProviders.addAfterRetryPolicies(policies);
+ policies.add(new HttpLoggingPolicy(httpLogOptions));
+ HttpPipeline httpPipeline =
+ new HttpPipelineBuilder()
+ .policies(policies.toArray(new HttpPipelinePolicy[0]))
+ .httpClient(httpClient)
+ .clientOptions(clientOptions)
+ .build();
+ return httpPipeline;
+ }
+
+ /**
+ * Builds an instance of InstancesAsyncClient async client.
+ *
+ * @return an instance of InstancesAsyncClient.
+ */
+ public InstancesAsyncClient buildInstancesAsyncClient() {
+ return new InstancesAsyncClient(buildInnerClient().getInstances());
+ }
+
+ /**
+ * Builds an instance of IdentityAsyncClient async client.
+ *
+ * @return an instance of IdentityAsyncClient.
+ */
+ public IdentityAsyncClient buildIdentityAsyncClient() {
+ return new IdentityAsyncClient(buildInnerClient().getIdentities());
+ }
+
+ /**
+ * Builds an instance of InstancesClient sync client.
+ *
+ * @return an instance of InstancesClient.
+ */
+ public InstancesClient buildInstancesClient() {
+ return new InstancesClient(buildInnerClient().getInstances());
+ }
+
+ /**
+ * Builds an instance of IdentityClient sync client.
+ *
+ * @return an instance of IdentityClient.
+ */
+ public IdentityClient buildIdentityClient() {
+ return new IdentityClient(buildInnerClient().getIdentities());
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstanceMetadataClientServiceVersion.java b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstanceMetadataClientServiceVersion.java
new file mode 100644
index 0000000000000..b785e001663f3
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstanceMetadataClientServiceVersion.java
@@ -0,0 +1,33 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds;
+
+import com.azure.core.util.ServiceVersion;
+
+/** Service version of InstanceMetadataClient. */
+public enum InstanceMetadataClientServiceVersion implements ServiceVersion {
+ /** Enum value 2018-04-02. */
+ V2018_04_02("2018-04-02");
+
+ private final String version;
+
+ InstanceMetadataClientServiceVersion(String version) {
+ this.version = version;
+ }
+
+ @Override
+ public String getVersion() {
+ return this.version;
+ }
+
+ /**
+ * Gets the latest service version supported by this client library.
+ *
+ * @return The latest {@link InstanceMetadataClientServiceVersion}.
+ */
+ public static InstanceMetadataClientServiceVersion getLatest() {
+ return V2018_04_02;
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstancesAsyncClient.java b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstancesAsyncClient.java
new file mode 100644
index 0000000000000..d3ee835814596
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstancesAsyncClient.java
@@ -0,0 +1,67 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds;
+
+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.HttpResponseException;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.imds.imds.implementation.InstancesImpl;
+import reactor.core.publisher.Mono;
+
+/** Initializes a new instance of the asynchronous InstanceMetadataClient type. */
+@ServiceClient(builder = InstanceMetadataClientBuilder.class, isAsync = true)
+public final class InstancesAsyncClient {
+ @Generated private final InstancesImpl serviceClient;
+
+ /**
+ * Initializes an instance of Instances client.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ InstancesAsyncClient(InstancesImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Get Instance Metadata for the Virtual Machine.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * apiVersion | String | Yes | Api Version |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return instance Metadata for the Virtual Machine.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getMetadataWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.getMetadataWithResponseAsync(requestOptions);
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstancesClient.java b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstancesClient.java
new file mode 100644
index 0000000000000..7112062e73e59
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/InstancesClient.java
@@ -0,0 +1,66 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds;
+
+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.HttpResponseException;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.imds.imds.implementation.InstancesImpl;
+
+/** Initializes a new instance of the synchronous InstanceMetadataClient type. */
+@ServiceClient(builder = InstanceMetadataClientBuilder.class)
+public final class InstancesClient {
+ @Generated private final InstancesImpl serviceClient;
+
+ /**
+ * Initializes an instance of Instances client.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ InstancesClient(InstancesImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Get Instance Metadata for the Virtual Machine.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * apiVersion | String | Yes | Api Version |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return instance Metadata for the Virtual Machine.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getMetadataWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.getMetadataWithResponse(requestOptions);
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/implementation/IdentitiesImpl.java b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/implementation/IdentitiesImpl.java
new file mode 100644
index 0000000000000..52b9945a87c2d
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/implementation/IdentitiesImpl.java
@@ -0,0 +1,304 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds.implementation;
+
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+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.exception.HttpResponseException;
+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 reactor.core.publisher.Mono;
+
+/** An instance of this class provides access to all the operations defined in Identities. */
+public final class IdentitiesImpl {
+ /** The proxy service used to perform REST calls. */
+ private final IdentitiesService service;
+
+ /** The service client containing this operation class. */
+ private final InstanceMetadataClientImpl client;
+
+ /**
+ * Initializes an instance of IdentitiesImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ IdentitiesImpl(InstanceMetadataClientImpl client) {
+ this.service =
+ RestProxy.create(IdentitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for InstanceMetadataClientIdentities to be used by the proxy service to
+ * perform REST calls.
+ */
+ @Host("{$host}")
+ @ServiceInterface(name = "InstanceMetadataClie")
+ private interface IdentitiesService {
+ @Get("/identity/oauth2/token")
+ @ExpectedResponses({200, 400, 404, 405, 429, 500})
+ Mono> getToken(
+ @HostParam("$host") String host,
+ @QueryParam("api-version") String apiVersion,
+ RequestOptions requestOptions,
+ Context context);
+
+ @Get("/identity/info")
+ @ExpectedResponses({200, 400, 404, 405, 429, 500})
+ Mono> getInfo(
+ @HostParam("$host") String host,
+ @QueryParam("api-version") String apiVersion,
+ RequestOptions requestOptions,
+ Context context);
+ }
+
+ /**
+ * Get a Token from Azure AD.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * resource | String | Yes | This is the urlencoded identifier URI of the sink resource for the requested Azure AD token. The resulting token contains the corresponding aud for this resource. |
+ * apiVersion | String | Yes | Api Version |
+ * clientId | String | No | This identifies, by Azure AD client id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with object_id and msi_res_id. |
+ * objectId | String | No | This identifies, by Azure AD object id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and msi_res_id. |
+ * msiResId | String | No | This identifies, by urlencoded ARM resource id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and object_id. |
+ * authority | String | No | This indicates the authority to request AAD tokens from. Defaults to the known authority of the identity to be used. |
+ * bypassCache | String | No | If provided, the value must be 'true'. This indicates to the server that the token must be retrieved from Azure AD and cannot be retrieved from an internal cache. |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return a Token from Azure AD.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getTokenWithResponseAsync(RequestOptions requestOptions) {
+ return FluxUtil.withContext(
+ context ->
+ service.getToken(
+ this.client.getHost(),
+ this.client.getServiceVersion().getVersion(),
+ requestOptions,
+ context));
+ }
+
+ /**
+ * Get a Token from Azure AD.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * resource | String | Yes | This is the urlencoded identifier URI of the sink resource for the requested Azure AD token. The resulting token contains the corresponding aud for this resource. |
+ * apiVersion | String | Yes | Api Version |
+ * clientId | String | No | This identifies, by Azure AD client id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with object_id and msi_res_id. |
+ * objectId | String | No | This identifies, by Azure AD object id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and msi_res_id. |
+ * msiResId | String | No | This identifies, by urlencoded ARM resource id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and object_id. |
+ * authority | String | No | This indicates the authority to request AAD tokens from. Defaults to the known authority of the identity to be used. |
+ * bypassCache | String | No | If provided, the value must be 'true'. This indicates to the server that the token must be retrieved from Azure AD and cannot be retrieved from an internal cache. |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @param context The context to associate with this operation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return a Token from Azure AD.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getTokenWithResponseAsync(RequestOptions requestOptions, Context context) {
+ return service.getToken(
+ this.client.getHost(), this.client.getServiceVersion().getVersion(), requestOptions, context);
+ }
+
+ /**
+ * Get a Token from Azure AD.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * resource | String | Yes | This is the urlencoded identifier URI of the sink resource for the requested Azure AD token. The resulting token contains the corresponding aud for this resource. |
+ * apiVersion | String | Yes | Api Version |
+ * clientId | String | No | This identifies, by Azure AD client id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with object_id and msi_res_id. |
+ * objectId | String | No | This identifies, by Azure AD object id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and msi_res_id. |
+ * msiResId | String | No | This identifies, by urlencoded ARM resource id, a specific explicit identity to use when authenticating to Azure AD. Mutually exclusive with client_id and object_id. |
+ * authority | String | No | This indicates the authority to request AAD tokens from. Defaults to the known authority of the identity to be used. |
+ * bypassCache | String | No | If provided, the value must be 'true'. This indicates to the server that the token must be retrieved from Azure AD and cannot be retrieved from an internal cache. |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return a Token from Azure AD.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getTokenWithResponse(RequestOptions requestOptions) {
+ return getTokenWithResponseAsync(requestOptions).block();
+ }
+
+ /**
+ * Get information about AAD Metadata.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * apiVersion | String | Yes | Api Version |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return information about AAD Metadata.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getInfoWithResponseAsync(RequestOptions requestOptions) {
+ return FluxUtil.withContext(
+ context ->
+ service.getInfo(
+ this.client.getHost(),
+ this.client.getServiceVersion().getVersion(),
+ requestOptions,
+ context));
+ }
+
+ /**
+ * Get information about AAD Metadata.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * apiVersion | String | Yes | Api Version |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @param context The context to associate with this operation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return information about AAD Metadata.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getInfoWithResponseAsync(RequestOptions requestOptions, Context context) {
+ return service.getInfo(
+ this.client.getHost(), this.client.getServiceVersion().getVersion(), requestOptions, context);
+ }
+
+ /**
+ * Get information about AAD Metadata.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * apiVersion | String | Yes | Api Version |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return information about AAD Metadata.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getInfoWithResponse(RequestOptions requestOptions) {
+ return getInfoWithResponseAsync(requestOptions).block();
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/implementation/InstanceMetadataClientImpl.java b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/implementation/InstanceMetadataClientImpl.java
new file mode 100644
index 0000000000000..6896b4504c16c
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/implementation/InstanceMetadataClientImpl.java
@@ -0,0 +1,138 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds.implementation;
+
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
+import com.azure.core.http.policy.CookiePolicy;
+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.imds.imds.InstanceMetadataClientServiceVersion;
+
+/** Initializes a new instance of the InstanceMetadataClient type. */
+public final class InstanceMetadataClientImpl {
+ /** server parameter. */
+ private final String host;
+
+ /**
+ * Gets server parameter.
+ *
+ * @return the host value.
+ */
+ public String getHost() {
+ return this.host;
+ }
+
+ /** Service version. */
+ private final InstanceMetadataClientServiceVersion serviceVersion;
+
+ /**
+ * Gets Service version.
+ *
+ * @return the serviceVersion value.
+ */
+ public InstanceMetadataClientServiceVersion 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 InstancesImpl object to access its operations. */
+ private final InstancesImpl instances;
+
+ /**
+ * Gets the InstancesImpl object to access its operations.
+ *
+ * @return the InstancesImpl object.
+ */
+ public InstancesImpl getInstances() {
+ return this.instances;
+ }
+
+ /** The IdentitiesImpl object to access its operations. */
+ private final IdentitiesImpl identities;
+
+ /**
+ * Gets the IdentitiesImpl object to access its operations.
+ *
+ * @return the IdentitiesImpl object.
+ */
+ public IdentitiesImpl getIdentities() {
+ return this.identities;
+ }
+
+ /**
+ * Initializes an instance of InstanceMetadataClient client.
+ *
+ * @param host server parameter.
+ * @param serviceVersion Service version.
+ */
+ public InstanceMetadataClientImpl(String host, InstanceMetadataClientServiceVersion serviceVersion) {
+ this(
+ new HttpPipelineBuilder()
+ .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy())
+ .build(),
+ JacksonAdapter.createDefaultSerializerAdapter(),
+ host,
+ serviceVersion);
+ }
+
+ /**
+ * Initializes an instance of InstanceMetadataClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param host server parameter.
+ * @param serviceVersion Service version.
+ */
+ public InstanceMetadataClientImpl(
+ HttpPipeline httpPipeline, String host, InstanceMetadataClientServiceVersion serviceVersion) {
+ this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), host, serviceVersion);
+ }
+
+ /**
+ * Initializes an instance of InstanceMetadataClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param serializerAdapter The serializer to serialize an object into a string.
+ * @param host server parameter.
+ * @param serviceVersion Service version.
+ */
+ public InstanceMetadataClientImpl(
+ HttpPipeline httpPipeline,
+ SerializerAdapter serializerAdapter,
+ String host,
+ InstanceMetadataClientServiceVersion serviceVersion) {
+ this.httpPipeline = httpPipeline;
+ this.serializerAdapter = serializerAdapter;
+ this.host = host;
+ this.serviceVersion = serviceVersion;
+ this.instances = new InstancesImpl(this);
+ this.identities = new IdentitiesImpl(this);
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/implementation/InstancesImpl.java b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/implementation/InstancesImpl.java
new file mode 100644
index 0000000000000..37b126bc27782
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/implementation/InstancesImpl.java
@@ -0,0 +1,168 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds.implementation;
+
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+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.exception.HttpResponseException;
+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 reactor.core.publisher.Mono;
+
+/** An instance of this class provides access to all the operations defined in Instances. */
+public final class InstancesImpl {
+ /** The proxy service used to perform REST calls. */
+ private final InstancesService service;
+
+ /** The service client containing this operation class. */
+ private final InstanceMetadataClientImpl client;
+
+ /**
+ * Initializes an instance of InstancesImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ InstancesImpl(InstanceMetadataClientImpl client) {
+ this.service =
+ RestProxy.create(InstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for InstanceMetadataClientInstances to be used by the proxy service to
+ * perform REST calls.
+ */
+ @Host("{$host}")
+ @ServiceInterface(name = "InstanceMetadataClie")
+ private interface InstancesService {
+ @Get("/instance")
+ @ExpectedResponses({200, 400, 403, 404, 405, 429, 500, 503})
+ Mono> getMetadata(
+ @HostParam("$host") String host,
+ @QueryParam("api-version") String apiVersion,
+ RequestOptions requestOptions,
+ Context context);
+ }
+
+ /**
+ * Get Instance Metadata for the Virtual Machine.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * apiVersion | String | Yes | Api Version |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return instance Metadata for the Virtual Machine.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getMetadataWithResponseAsync(RequestOptions requestOptions) {
+ return FluxUtil.withContext(
+ context ->
+ service.getMetadata(
+ this.client.getHost(),
+ this.client.getServiceVersion().getVersion(),
+ requestOptions,
+ context));
+ }
+
+ /**
+ * Get Instance Metadata for the Virtual Machine.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * apiVersion | String | Yes | Api Version |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @param context The context to associate with this operation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return instance Metadata for the Virtual Machine.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getMetadataWithResponseAsync(RequestOptions requestOptions, Context context) {
+ return service.getMetadata(
+ this.client.getHost(), this.client.getServiceVersion().getVersion(), requestOptions, context);
+ }
+
+ /**
+ * Get Instance Metadata for the Virtual Machine.
+ *
+ * Query Parameters
+ *
+ *
+ * Query Parameters
+ * Name | Type | Required | Description |
+ * apiVersion | String | Yes | Api Version |
+ *
+ *
+ * Header Parameters
+ *
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * metadata | String | Yes | This must be set to 'true'. |
+ *
+ *
+ * Response Body Schema
+ *
+ *
{@code
+ * Object
+ * }
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @return instance Metadata for the Virtual Machine.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getMetadataWithResponse(RequestOptions requestOptions) {
+ return getMetadataWithResponseAsync(requestOptions).block();
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/package-info.java b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/package-info.java
new file mode 100644
index 0000000000000..eeb6e9d1cbe8c
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/main/java/com/azure/imds/imds/package-info.java
@@ -0,0 +1,6 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+/** Package containing the classes for InstanceMetadataClient. The Azure Instance Metadata Client. */
+package com.azure.imds.imds;
diff --git a/sdk/imds/azure-imds-imds/src/main/java/module-info.java b/sdk/imds/azure-imds-imds/src/main/java/module-info.java
new file mode 100644
index 0000000000000..0d671f82035f3
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/main/java/module-info.java
@@ -0,0 +1,9 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+module com.azure.imds.imds {
+ requires transitive com.azure.core;
+
+ exports com.azure.imds.imds;
+}
diff --git a/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/ReadmeSamples.java b/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/ReadmeSamples.java
new file mode 100644
index 0000000000000..6e6a0d0953939
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/ReadmeSamples.java
@@ -0,0 +1,12 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds;
+
+public final class ReadmeSamples {
+ public void readmeSamples() {
+ // BEGIN: com.azure.imds.imds.readme
+ // END: com.azure.imds.imds.readme
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/generated/GetIdentityInfoForTheVM.java b/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/generated/GetIdentityInfoForTheVM.java
new file mode 100644
index 0000000000000..90e68742f9e2e
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/generated/GetIdentityInfoForTheVM.java
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds.generated;
+
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.identity.DefaultAzureCredentialBuilder;
+import com.azure.imds.imds.IdentityClient;
+import com.azure.imds.imds.InstanceMetadataClientBuilder;
+
+public class GetIdentityInfoForTheVM {
+ public static void main(String[] args) {
+ IdentityClient client =
+ new InstanceMetadataClientBuilder()
+ .credential(new DefaultAzureCredentialBuilder().build())
+ .host("https://169.254.169.254/metadata")
+ .buildIdentityClient();
+ RequestOptions requestOptions = new RequestOptions();
+ requestOptions.addHeader("Metadata", "true");
+ Response response = client.getInfoWithResponse(requestOptions);
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/generated/GetIdentityTokenForTheVM.java b/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/generated/GetIdentityTokenForTheVM.java
new file mode 100644
index 0000000000000..2ae0d99cdb5f0
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/generated/GetIdentityTokenForTheVM.java
@@ -0,0 +1,26 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds.generated;
+
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.identity.DefaultAzureCredentialBuilder;
+import com.azure.imds.imds.IdentityClient;
+import com.azure.imds.imds.InstanceMetadataClientBuilder;
+
+public class GetIdentityTokenForTheVM {
+ public static void main(String[] args) {
+ IdentityClient client =
+ new InstanceMetadataClientBuilder()
+ .credential(new DefaultAzureCredentialBuilder().build())
+ .host("https://169.254.169.254/metadata")
+ .buildIdentityClient();
+ RequestOptions requestOptions = new RequestOptions();
+ requestOptions.addHeader("Metadata", "true");
+ requestOptions.addQueryParam("resource", "https://vault.azure.net");
+ Response response = client.getTokenWithResponse(requestOptions);
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/generated/GetInstanceMetadataForTheVM.java b/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/generated/GetInstanceMetadataForTheVM.java
new file mode 100644
index 0000000000000..ee0809ef04dd2
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/samples/java/com/azure/imds/imds/generated/GetInstanceMetadataForTheVM.java
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds.generated;
+
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.identity.DefaultAzureCredentialBuilder;
+import com.azure.imds.imds.InstanceMetadataClientBuilder;
+import com.azure.imds.imds.InstancesClient;
+
+public class GetInstanceMetadataForTheVM {
+ public static void main(String[] args) {
+ InstancesClient client =
+ new InstanceMetadataClientBuilder()
+ .credential(new DefaultAzureCredentialBuilder().build())
+ .host("https://169.254.169.254/metadata")
+ .buildInstancesClient();
+ RequestOptions requestOptions = new RequestOptions();
+ requestOptions.addHeader("Metadata", "true");
+ Response response = client.getMetadataWithResponse(requestOptions);
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/src/test/java/com/azure/imds/imds/ClientTests.java b/sdk/imds/azure-imds-imds/src/test/java/com/azure/imds/imds/ClientTests.java
new file mode 100644
index 0000000000000..e0de41e1e0dba
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/src/test/java/com/azure/imds/imds/ClientTests.java
@@ -0,0 +1,47 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+
+package com.azure.imds.imds;
+
+import com.azure.core.credential.AccessToken;
+import com.azure.core.http.HttpClient;
+import com.azure.core.http.policy.HttpLogDetailLevel;
+import com.azure.core.http.policy.HttpLogOptions;
+import com.azure.core.test.TestBase;
+import com.azure.core.test.TestMode;
+import com.azure.core.test.annotation.DoNotRecord;
+import com.azure.core.util.Configuration;
+import com.azure.identity.DefaultAzureCredentialBuilder;
+import java.time.OffsetDateTime;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import reactor.core.publisher.Mono;
+
+public final class ClientTests extends TestBase {
+ private InstanceMetadataClientBuilder builder;
+
+ @BeforeEach
+ public void setup() {
+ builder =
+ new InstanceMetadataClientBuilder()
+ .host(Configuration.getGlobalConfiguration().get("HOST", "https://169.254.169.254/metadata"))
+ .httpClient(HttpClient.createDefault())
+ .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS));
+ if (getTestMode() == TestMode.PLAYBACK) {
+ builder.httpClient(interceptorManager.getPlaybackClient())
+ .credential(request -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)));
+ } else if (getTestMode() == TestMode.RECORD) {
+ builder.addPolicy(interceptorManager.getRecordPolicy())
+ .credential(new DefaultAzureCredentialBuilder().build());
+ } else if (getTestMode() == TestMode.LIVE) {
+ builder.credential(new DefaultAzureCredentialBuilder().build());
+ }
+ }
+
+ @Test
+ @DoNotRecord(skipInPlayback = true)
+ public void testClient() {
+ // use the builder to create client
+ }
+}
diff --git a/sdk/imds/azure-imds-imds/swagger/README_SPEC.md b/sdk/imds/azure-imds-imds/swagger/README_SPEC.md
new file mode 100644
index 0000000000000..fa28f5bc5b534
--- /dev/null
+++ b/sdk/imds/azure-imds-imds/swagger/README_SPEC.md
@@ -0,0 +1,24 @@
+## Generate autorest code
+
+```yaml
+input-file:
+ - /home/vsts/work/1/s/azure-rest-api-specs/specification/imds/data-plane/Microsoft.InstanceMetadataService/stable/2018-04-02/imds.json
+java: true
+output-folder: ../
+regenerate-pom: false
+generate-sync-async-clients: true
+generate-client-as-impl: true
+generate-client-interfaces: false
+add-context-parameter: true
+low-level-client: true
+sync-methods: all
+generate-samples: true
+license-header: MICROSOFT_MIT_SMALL
+namespace: com.azure.imds.imds
+context-client-method-parameter: true
+azure-arm: false
+credential-types: tokencredential
+credential-scopes: https://imds.azure.com/.default
+service-versions:
+ - '2018-04-02'
+```