Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,10 @@ public final class BlobItemInternal {
private BlobTags blobTags;

/*
* The objectReplicationPolicyId property.
* The objectReplicationMetadata property.
*/
@JsonProperty(value = "ObjectReplicationPolicyId")
private String objectReplicationPolicyId;

/*
* The objectReplicationRules property.
*/
@JsonProperty(value = "BlobObjectReplicationRules")
private Map<String, String> objectReplicationRules;
@JsonProperty(value = "OrMetadata")
private Map<String, String> objectReplicationMetadata;

/*
* The isPrefix property.
Expand Down Expand Up @@ -242,47 +236,25 @@ public BlobItemInternal setBlobTags(BlobTags blobTags) {
}

/**
* Get the objectReplicationPolicyId property: The
* objectReplicationPolicyId property.
* Get the objectReplicationMetadata property: The
* objectReplicationMetadata property.
*
* @return the objectReplicationPolicyId value.
* @return the objectReplicationMetadata value.
*/
public String getObjectReplicationPolicyId() {
return this.objectReplicationPolicyId;
public Map<String, String> getObjectReplicationMetadata() {
return this.objectReplicationMetadata;
}

/**
* Set the objectReplicationPolicyId property: The
* objectReplicationPolicyId property.
* Set the objectReplicationMetadata property: The
* objectReplicationMetadata property.
*
* @param objectReplicationPolicyId the objectReplicationPolicyId value to
* @param objectReplicationMetadata the objectReplicationMetadata value to
* set.
* @return the BlobItemInternal object itself.
*/
public BlobItemInternal setObjectReplicationPolicyId(String objectReplicationPolicyId) {
this.objectReplicationPolicyId = objectReplicationPolicyId;
return this;
}

/**
* Get the objectReplicationRules property: The objectReplicationRules
* property.
*
* @return the objectReplicationRules value.
*/
public Map<String, String> getObjectReplicationRules() {
return this.objectReplicationRules;
}

/**
* Set the objectReplicationRules property: The objectReplicationRules
* property.
*
* @param objectReplicationRules the objectReplicationRules value to set.
* @return the BlobItemInternal object itself.
*/
public BlobItemInternal setObjectReplicationRules(Map<String, String> objectReplicationRules) {
this.objectReplicationRules = objectReplicationRules;
public BlobItemInternal setObjectReplicationMetadata(Map<String, String> objectReplicationMetadata) {
this.objectReplicationMetadata = objectReplicationMetadata;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,28 @@ public final class DataLakeStorageError {
* The service error response object.
*/
@JsonProperty(value = "error")
private DataLakeStorageErrorError error;
private DataLakeStorageErrorError dataLakeStorageErrorDetails;

/**
* Get the error property: The service error response object.
* Get the dataLakeStorageErrorDetails property: The service error response
* object.
*
* @return the error value.
* @return the dataLakeStorageErrorDetails value.
*/
public DataLakeStorageErrorError getError() {
return this.error;
public DataLakeStorageErrorError getDataLakeStorageErrorDetails() {
return this.dataLakeStorageErrorDetails;
}

/**
* Set the error property: The service error response object.
* Set the dataLakeStorageErrorDetails property: The service error response
* object.
*
* @param error the error value to set.
* @param dataLakeStorageErrorDetails the dataLakeStorageErrorDetails value
* to set.
* @return the DataLakeStorageError object itself.
*/
public DataLakeStorageError setError(DataLakeStorageErrorError error) {
this.error = error;
public DataLakeStorageError setDataLakeStorageErrorDetails(DataLakeStorageErrorError dataLakeStorageErrorDetails) {
this.dataLakeStorageErrorDetails = dataLakeStorageErrorDetails;
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.storage.blob.implementation.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;

/**
* Additional parameters for a set of operations.
*/
@JacksonXmlRootElement(localName = "modified-access-conditions")
@Fluent
public final class ModifiedAccessConditions {
/*
* Specify a SQL where clause on blob tags to operate only on blobs with a
* matching value.
*/
@JsonProperty(value = "ifTags")
private String ifTags;

/**
* Get the ifTags property: Specify a SQL where clause on blob tags to
* operate only on blobs with a matching value.
*
* @return the ifTags value.
*/
public String getIfTags() {
return this.ifTags;
}

/**
* Set the ifTags property: Specify a SQL where clause on blob tags to
* operate only on blobs with a matching value.
*
* @param ifTags the ifTags value to set.
* @return the ModifiedAccessConditions object itself.
*/
public ModifiedAccessConditions setIfTags(String ifTags) {
this.ifTags = ifTags;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public final class BlobItem {
*/
public BlobItem() {
tags = null;
objectReplicationSourcePolicies = null;
}

/**
Expand All @@ -48,6 +49,25 @@ public BlobItem(BlobItemInternal blobItemInternal) {
this.tags.put(tag.getKey(), tag.getValue());
}
}
this.objectReplicationSourcePolicies = null;
if (blobItemInternal.getObjectReplicationMetadata() != null) {
this.objectReplicationSourcePolicies = new HashMap<>();
for (Map.Entry<String, String> p : blobItemInternal.getObjectReplicationMetadata().entrySet()) {
String orString = p.getKey();
String str = orString.startsWith("or-") ? orString.substring(3) : orString;
String[] split = str.split("_");
String policyId = split[0];
String ruleId = split[1];
if (objectReplicationSourcePolicies.containsKey(policyId)) {
objectReplicationSourcePolicies.get(policyId)
.putRuleAndStatus(ruleId, p.getValue());
} else {
ObjectReplicationPolicy policy = new ObjectReplicationPolicy(policyId);
policy.putRuleAndStatus(ruleId, p.getValue());
objectReplicationSourcePolicies.put(policyId, policy);
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to find new home. We need to decouple model from "implementation model" per APIView feedback.
Anyway, it's a good practice to NOT place such logic inside constructors. BlobItem should ideally be plain data structure and this logic should move to some "transformer/mapper".

}

/*
Expand Down Expand Up @@ -90,17 +110,10 @@ public BlobItem(BlobItemInternal blobItemInternal) {

private Boolean isCurrentVersion;

/*
* The objectReplicationPolicyId property.
/*
* The objectReplicationSourcePolicies property.
*/
@JsonProperty(value = "ObjectReplicationPolicyId")
private String objectReplicationPolicyId;

/*
* The objectReplicationRuleStatus property.
*/
@JsonProperty(value = "BlobObjectReplicationRuleStatus")
private Map<String, String> objectReplicationRuleStatus;
private Map<String, ObjectReplicationPolicy> objectReplicationSourcePolicies;

/*
* The isPrefix property.
Expand Down Expand Up @@ -258,48 +271,26 @@ public BlobItem setIsCurrentVersion(Boolean isCurrentVersion) {
}

/**
* Get the objectReplicationPolicyId property: The
* objectReplicationPolicyId property.
*
* @return the objectReplicationPolicyId value.
*/
public String getObjectReplicationPolicyId() {
return this.objectReplicationPolicyId;
}

/**
* Set the objectReplicationPolicyId property: The
* objectReplicationPolicyId property.
*
* @param objectReplicationPolicyId the objectReplicationPolicyId value to
* set.
* @return the BlobItem object itself.
*/
public BlobItem setObjectReplicationPolicyId(String objectReplicationPolicyId) {
this.objectReplicationPolicyId = objectReplicationPolicyId;
return this;
}

/**
* Get the objectReplicationRuleStatus property: The
* objectReplicationRuleStatus property.
* Get the objectReplicationSourcePolicies property: The
* objectReplicationSourcePolicies property.
*
* @return the objectReplicationRuleStatus value.
* @return the objectReplicationSourcePolicies value.
*/
public Map<String, String> getObjectReplicationRuleStatus() {
return this.objectReplicationRuleStatus;
public Map<String, ObjectReplicationPolicy> getObjectReplicationSourcePolicies() {
return this.objectReplicationSourcePolicies;
}

/**
* Set the objectReplicationRuleStatus property: The
* objectReplicationRuleStatus property.
* Set the objectReplicationSourcePolicies property: The
* objectReplicationSourcePolicies property.
*
* @param objectReplicationRuleStatus the objectReplicationRuleStatus value
* @param objectReplicationSourcePolicies the objectReplicationSourcePolicies value
* to set.
* @return the BlobItem object itself.
*/
public BlobItem setObjectReplicationRuleStatus(Map<String, String> objectReplicationRuleStatus) {
this.objectReplicationRuleStatus = objectReplicationRuleStatus;
public BlobItem setObjectReplicationSourcePolicies(
Map<String, ObjectReplicationPolicy> objectReplicationSourcePolicies) {
this.objectReplicationSourcePolicies = objectReplicationSourcePolicies;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.azure.storage.blob.implementation.models.BlobItemPropertiesInternal;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;

import java.time.OffsetDateTime;

/**
Expand Down Expand Up @@ -64,25 +65,6 @@ public BlobItemProperties(BlobItemPropertiesInternal blobItemPropertiesInternal)
this.encryptionScope = blobItemPropertiesInternal.getEncryptionScope();
this.accessTierChangeTime = blobItemPropertiesInternal.getAccessTierChangeTime();
this.tagCount = blobItemPropertiesInternal.getTagCount();

// TODO: (rickle-msft) Uncomment when these properties are returned on lists.
/*this.objectReplicationSourcePolicies = new HashMap<>();
this.objectReplicationDestinationPolicyId = objectReplicationStatus.getOrDefault("policy-id", null);
if (objectReplicationDestinationPolicyId == null) {
for (String str : objectReplicationStatus.keySet()) {
String[] split = str.split("_");
String policyId = split[0];
String ruleId = split[1];
if (objectReplicationSourcePolicies.containsKey(policyId)) {
objectReplicationSourcePolicies.get(policyId)
.putRuleAndStatus(ruleId, objectReplicationStatus.get(str));
} else {
ObjectReplicationPolicy policy = new ObjectReplicationPolicy(policyId);
policy.putRuleAndStatus(ruleId, objectReplicationStatus.get(str));
objectReplicationSourcePolicies.put(policyId, policy);
}
}
}*/
}

/*
Expand Down Expand Up @@ -280,13 +262,6 @@ public BlobItemProperties(BlobItemPropertiesInternal blobItemPropertiesInternal)
@JsonProperty(value = "AccessTierChangeTime")
private OffsetDateTime accessTierChangeTime;

// TODO: (rickle-msft) uncomment when these are returned on lists.
/*
private Map<String, ObjectReplicationPolicy> objectReplicationSourcePolicies;

private String objectReplicationDestinationPolicyId;
*/

/*
* The tagCount property.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Mono<Response<AppendBlobItem>> createWithResponse(AppendBlobCreateOptions option
options.getMetadata(), requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(),
requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(),
requestConditions.getIfNoneMatch(), null, tagsToString(options.getTags()), options.getHeaders(),
getCustomerProvidedKey(), encryptionScope,
getCustomerProvidedKey(), encryptionScope, null,
context.addData(AZ_TRACING_NAMESPACE_KEY, STORAGE_TRACING_NAMESPACE_VALUE))
.map(rb -> {
AppendBlobCreateHeaders hd = rb.getDeserializedHeaders();
Expand Down Expand Up @@ -269,7 +269,7 @@ Mono<Response<AppendBlobItem>> appendBlockWithResponse(Flux<ByteBuffer> data, lo
appendBlobRequestConditions.getMaxSize(), appendBlobRequestConditions.getAppendPosition(),
appendBlobRequestConditions.getIfModifiedSince(), appendBlobRequestConditions.getIfUnmodifiedSince(),
appendBlobRequestConditions.getIfMatch(), appendBlobRequestConditions.getIfNoneMatch(), null,
getCustomerProvidedKey(), encryptionScope,
getCustomerProvidedKey(), encryptionScope, null,
context.addData(AZ_TRACING_NAMESPACE_KEY, STORAGE_TRACING_NAMESPACE_VALUE))
.map(rb -> {
AppendBlobAppendBlockHeaders hd = rb.getDeserializedHeaders();
Expand Down Expand Up @@ -357,7 +357,7 @@ Mono<Response<AppendBlobItem>> appendBlockFromUrlWithResponse(String sourceUrl,
destRequestConditions.getIfMatch(), destRequestConditions.getIfNoneMatch(),
sourceRequestConditions.getIfModifiedSince(), sourceRequestConditions.getIfUnmodifiedSince(),
sourceRequestConditions.getIfMatch(), sourceRequestConditions.getIfNoneMatch(), null,
getCustomerProvidedKey(), encryptionScope,
getCustomerProvidedKey(), encryptionScope, null,
context.addData(AZ_TRACING_NAMESPACE_KEY, STORAGE_TRACING_NAMESPACE_VALUE))
.map(rb -> {
AppendBlobAppendBlockFromUrlHeaders hd = rb.getDeserializedHeaders();
Expand Down
Loading