Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.2 (Unreleased)
## 1.0.0-beta.1 (2024-05-08)

- Azure Resource Manager StorageActions client library for Java. This package contains Microsoft Azure SDK for StorageActions Management SDK. The Azure Storage Actions Management API. Package tag package-2023-01-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

### Features Added

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-storageactions</artifactId>
<version>1.0.0-beta.1</version>
<version>1.0.0-beta.2</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
235 changes: 131 additions & 104 deletions sdk/storageactions/azure-resourcemanager-storageactions/SAMPLE.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
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.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.http.policy.HttpPolicyProviders;
import com.azure.core.http.policy.RequestIdPolicy;
Expand Down Expand Up @@ -59,8 +59,10 @@ private StorageActionsManager(HttpPipeline httpPipeline, AzureProfile profile, D
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
this.clientObject = new StorageActionsMgmtClientBuilder().pipeline(httpPipeline)
.endpoint(profile.getEnvironment().getResourceManagerEndpoint()).subscriptionId(profile.getSubscriptionId())
.defaultPollInterval(defaultPollInterval).buildClient();
.endpoint(profile.getEnvironment().getResourceManagerEndpoint())
.subscriptionId(profile.getSubscriptionId())
.defaultPollInterval(defaultPollInterval)
.buildClient();
}

/**
Expand Down Expand Up @@ -211,12 +213,19 @@ public StorageActionsManager authenticate(TokenCredential credential, AzureProfi
Objects.requireNonNull(profile, "'profile' cannot be null.");

StringBuilder userAgentBuilder = new StringBuilder();
userAgentBuilder.append("azsdk-java").append("-").append("com.azure.resourcemanager.storageactions")
.append("/").append("1.0.0-beta.1");
userAgentBuilder.append("azsdk-java")
.append("-")
.append("com.azure.resourcemanager.storageactions")
.append("/")
.append("1.0.0-beta.1");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (").append(Configuration.getGlobalConfiguration().get("java.version"))
.append("; ").append(Configuration.getGlobalConfiguration().get("os.name")).append("; ")
.append(Configuration.getGlobalConfiguration().get("os.version")).append("; auto-generated)");
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
.append("; ")
.append(Configuration.getGlobalConfiguration().get("os.name"))
.append("; ")
.append(Configuration.getGlobalConfiguration().get("os.version"))
.append("; auto-generated)");
} else {
userAgentBuilder.append(" (auto-generated)");
}
Expand All @@ -235,18 +244,21 @@ public StorageActionsManager authenticate(TokenCredential credential, AzureProfi
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
policies.add(new AddHeadersFromContextPolicy());
policies.add(new RequestIdPolicy());
policies.addAll(this.policies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
policies.addAll(this.policies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
.collect(Collectors.toList()));
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
policies.add(new AddDatePolicy());
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.addAll(this.policies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY).collect(Collectors.toList()));
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
.collect(Collectors.toList()));
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient)
.policies(policies.toArray(new HttpPipelinePolicy[0])).build();
.policies(policies.toArray(new HttpPipelinePolicy[0]))
.build();
return new StorageActionsManager(httpPipeline, profile, defaultPollInterval);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
public interface StorageTaskAssignmentsClient {
/**
* Lists all the storage tasks available under the given resource group.
* Lists Resource IDs of the Storage Task Assignments associated with this Storage Task.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param storageTaskName The name of the storage task within the specified resource group. Storage task names must
Expand All @@ -29,13 +29,13 @@ public interface StorageTaskAssignmentsClient {
PagedIterable<StorageTaskAssignmentInner> list(String resourceGroupName, String storageTaskName);

/**
* Lists all the storage tasks available under the given resource group.
* Lists Resource IDs of the Storage Task Assignments associated with this Storage Task.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param storageTaskName The name of the storage task within the specified resource group. Storage task names must
* be between 3 and 18 characters in length and use numbers and lower-case letters only.
* @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the
* list response.
* @param maxpagesize Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included
* in the list response.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ StorageTaskInner update(String resourceGroupName, String storageTaskName, Storag
*
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}.
* @return the response from the List Storage Task operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<StorageTaskInner> list();
Expand All @@ -264,7 +264,7 @@ StorageTaskInner update(String resourceGroupName, String storageTaskName, Storag
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}.
* @return the response from the List Storage Task operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<StorageTaskInner> list(Context context);
Expand All @@ -276,7 +276,7 @@ StorageTaskInner update(String resourceGroupName, String storageTaskName, Storag
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}.
* @return the response from the List Storage Task operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<StorageTaskInner> listByResourceGroup(String resourceGroupName);
Expand All @@ -289,7 +289,7 @@ StorageTaskInner update(String resourceGroupName, String storageTaskName, Storag
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response from the List Storage Tasks operation as paginated response with {@link PagedIterable}.
* @return the response from the List Storage Task operation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<StorageTaskInner> listByResourceGroup(String resourceGroupName, Context context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public interface StorageTasksReportsClient {
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param storageTaskName The name of the storage task within the specified resource group. Storage task names must
* be between 3 and 18 characters in length and use numbers and lower-case letters only.
* @param maxpagesize Optional, specifies the maximum number of storage task assignment Ids to be included in the
* list response.
* @param maxpagesize Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included
* in the list response.
* @param filter Optional. When specified, it can be used to query using reporting properties.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
@Fluent
public final class OperationInner {
/*
* The name of the operation, as per Resource-Based Access Control (RBAC). Examples:
* "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action"
* The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action"
*/
@JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
private String name;

/*
* Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for
* ARM/control-plane operations.
* Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations.
*/
@JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY)
private Boolean isDataAction;
Expand All @@ -38,8 +36,7 @@ public final class OperationInner {
private OperationDisplay display;

/*
* The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default
* value is "user,system"
* The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system"
*/
@JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY)
private Origin origin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Fetch the Storage task assignment ARM ids.
* Storage Task Assignment associated with this Storage Task.
*/
@Immutable
public final class StorageTaskAssignmentInner {
/*
* ARM Id of the storage task assignments, associated with the storage tasks.
* Resource ID of the Storage Task Assignment.
*/
@JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
private String id;
Expand All @@ -25,7 +25,7 @@ public StorageTaskAssignmentInner() {
}

/**
* Get the id property: ARM Id of the storage task assignments, associated with the storage tasks.
* Get the id property: Resource ID of the Storage Task Assignment.
*
* @return the id value.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.storageactions.models.ManagedServiceIdentity;
import com.azure.resourcemanager.storageactions.models.StorageTaskProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -20,13 +21,13 @@ public final class StorageTaskInner extends Resource {
/*
* The managed service identity of the resource.
*/
@JsonProperty(value = "identity")
@JsonProperty(value = "identity", required = true)
private ManagedServiceIdentity identity;

/*
* Properties of the storage task.
*/
@JsonProperty(value = "properties")
@JsonProperty(value = "properties", required = true)
private StorageTaskProperties properties;

/*
Expand Down Expand Up @@ -114,11 +115,19 @@ public StorageTaskInner withTags(Map<String, String> tags) {
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (identity() != null) {
if (identity() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property identity in model StorageTaskInner"));
} else {
identity().validate();
}
if (properties() != null) {
if (properties() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property properties in model StorageTaskInner"));
} else {
properties().validate();
}
}

private static final ClientLogger LOGGER = new ClientLogger(StorageTaskInner.class);
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ public StorageTaskPreviewActionInner withProperties(StorageTaskPreviewActionProp
*/
public void validate() {
if (properties() == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
"Missing required property properties in model StorageTaskPreviewActionInner"));
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property properties in model StorageTaskPreviewActionInner"));
} else {
properties().validate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public final class OperationsClientImpl implements OperationsClient {
}

/**
* The interface defining all the services for StorageActionsMgmtClientOperations to be used by the proxy service
* to perform REST calls.
* The interface defining all the services for StorageActionsMgmtClientOperations to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "StorageActionsMgmtCl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ static String getValueFromIdByName(String id, String name) {
}
}
return null;

}

static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) {
Expand Down Expand Up @@ -75,7 +74,6 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri
}
}
return null;

}

static <T, S> PagedIterable<S> mapPage(PagedIterable<T> pageIterable, Function<T, S> mapper) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ public StorageActionsMgmtClientBuilder serializerAdapter(SerializerAdapter seria
public StorageActionsMgmtClientImpl buildClient() {
String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com";
AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE;
HttpPipeline localPipeline = (pipeline != null) ? pipeline
HttpPipeline localPipeline = (pipeline != null)
? pipeline
: new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build();
Duration localDefaultPollInterval
= (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30);
SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter
SerializerAdapter localSerializerAdapter = (serializerAdapter != null)
? serializerAdapter
: SerializerFactory.createDefaultManagementSerializerAdapter();
StorageActionsMgmtClientImpl client = new StorageActionsMgmtClientImpl(localPipeline, localSerializerAdapter,
localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
package com.azure.resourcemanager.storageactions.implementation;

import com.azure.core.annotation.ServiceClient;
import com.azure.core.http.HttpHeaderName;
import com.azure.core.http.HttpHeaders;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpResponse;
import com.azure.core.http.rest.Response;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.exception.ManagementError;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.management.polling.PollerFactory;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
Expand Down Expand Up @@ -265,8 +266,8 @@ public <T, U> Mono<U> getLroFinalResultOrError(AsyncPollResponse<PollResult<T>,
if (errorBody != null) {
// try to deserialize error body to ManagementError
try {
managementError = this.getSerializerAdapter().deserialize(errorBody, ManagementError.class,
SerializerEncoding.JSON);
managementError = this.getSerializerAdapter()
.deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON);
if (managementError.getCode() == null || managementError.getMessage() == null) {
managementError = null;
}
Expand Down Expand Up @@ -307,7 +308,7 @@ public int getStatusCode() {
}

public String getHeaderValue(String s) {
return httpHeaders.getValue(s);
return httpHeaders.getValue(HttpHeaderName.fromString(s));
}

public HttpHeaders getHeaders() {
Expand Down
Loading