Skip to content

Conversation

@seanmcc-msft
Copy link
Member

…ent, FileClient, and DirectoryClient

@seanmcc-msft
Copy link
Member Author

@tg-msft, I'm thinking maybe we could potentially start grouping our optional parameters in this PR. What do you think?

}
#endregion Create

#region Create If Not Exists
Copy link
Member

Choose a reason for hiding this comment

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

NIT - remove spaces. Also I believe for blobs, I put the CreateIfNotExists methods in the Create region

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed CreateIfNotExists per Ted's comment.

}
#endregion Exists

#region Delete If Exists
Copy link
Member

Choose a reason for hiding this comment

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

NIT - Same thing I said about Create

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed the region DeleteIfExists.

Comment on lines 875 to 897
Response<bool> existsResponse = await ExistsInternal(
async,
cancellationToken,
operationName).ConfigureAwait(false);

if (existsResponse.Value)
{
return null;
}
else
{
return await CreateInternal(
maxSize,
httpHeaders,
metadata,
smbProperties,
filePermission,
conditions,
async,
cancellationToken,
operationName)
.ConfigureAwait(false);
}
Copy link
Member

Choose a reason for hiding this comment

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

This will cause race conditions. It would be better to try the Create call and ignore errors if it already exists like you did for the directory client.

Copy link
Member Author

Choose a reason for hiding this comment

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

https://docs.microsoft.com/en-us/rest/api/storageservices/create-file

I can't call Create an ignore errors, Create File overwrites existing files, and there are no conditional request headers. I think this might be the only way to do CreateIfNotExists for Files.

Copy link
Member

Choose a reason for hiding this comment

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

Oh... yeah, that's kind of scary. We don't want to give people APIs they can't be successful with so I think we should only add Exists and DeleteIfExists for now for File Shares.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed CreateIfNotExists from File Share.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants