-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to new api version 2023-06-30 (#36997)
* added changes for 2023-06-30 api release * updated generated files * fixed formatting in changelog * Updated method names and property types per previous review comments * Updated changelog to remove references to beta * Set InnerError to be internal Class * Fixed error related to changelog versions * Removed the ability to publicly set error in the import job model * Updated session records * Updated Apis --------- Co-authored-by: Austin Lynch <austinlynch@microsoft.com>
- Loading branch information
Showing
54 changed files
with
2,403 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
sdk/digitaltwins/Azure.DigitalTwins.Core/samples/DigitalTwinsClientSample/ImportJobHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Azure.Identity; | ||
using Azure.Storage.Blobs; | ||
|
||
namespace Azure.DigitalTwins.Core.Samples | ||
{ | ||
internal class ImportJobHelper | ||
{ | ||
/// <summary> | ||
/// Loads input blob into existing storage account | ||
/// </summary> | ||
/// <param name="options">reference to options passed in by user</param> | ||
/// <returns>true/false representing status of upload</returns> | ||
public static async Task<bool> UploadInputBlobToStorageContainerAsync(Options options) | ||
{ | ||
string filename = "sampleInputBlob.ndjson"; | ||
try | ||
{ | ||
BlobUriBuilder blobUriBuilder = new BlobUriBuilder(new Uri(options.StorageAccountContainerEndpoint)); | ||
BlobServiceClient serviceClient = new BlobServiceClient(blobUriBuilder.ToUri(), new DefaultAzureCredential()); | ||
BlobContainerClient containerClient = serviceClient.GetBlobContainerClient(blobUriBuilder.BlobContainerName); | ||
BlobClient blobClient = containerClient.GetBlobClient(filename); | ||
|
||
string localFilePath = "./" + filename; | ||
|
||
// upload the input blob file. overwrite if it already exists | ||
await blobClient.UploadAsync(localFilePath, overwrite: true); | ||
|
||
return true; | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine($"Error when uploading input blob to storage container due to: {ex}", ConsoleColor.Red); | ||
Environment.Exit(0); | ||
return false; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.