diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyClient.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyClient.cs index f81053449e3b..631d60416f10 100644 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyClient.cs +++ b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyClient.cs @@ -8,7 +8,6 @@ using System; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; @@ -44,38 +43,28 @@ protected CodeTransparencyClient() { } - /// Get the status the entry operation. - /// ID of the operation to retrieve. + /// Get the transparency service configuration, mandatory in IETF SCITT draft. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task> GetEntryStatusAsync(string operationId, CancellationToken cancellationToken = default) + /// + public virtual async Task> GetTransparencyConfigCborAsync(CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetEntryStatusAsync(operationId, context).ConfigureAwait(false); - return Response.FromValue(GetOperationResult.FromResponse(response), response); + Response response = await GetTransparencyConfigCborAsync(context).ConfigureAwait(false); + return Response.FromValue(response.Content, response); } - /// Get the status the entry operation. - /// ID of the operation to retrieve. + /// Get the transparency service configuration, mandatory in IETF SCITT draft. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Response GetEntryStatus(string operationId, CancellationToken cancellationToken = default) + /// + public virtual Response GetTransparencyConfigCbor(CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetEntryStatus(operationId, context); - return Response.FromValue(GetOperationResult.FromResponse(response), response); + Response response = GetTransparencyConfigCbor(context); + return Response.FromValue(response.Content, response); } /// - /// [Protocol Method] Get the status the entry operation + /// [Protocol Method] Get the transparency service configuration, mandatory in IETF SCITT draft /// /// /// @@ -84,27 +73,22 @@ public virtual Response GetEntryStatus(string operationId, C /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// ID of the operation to retrieve. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetEntryStatusAsync(string operationId, RequestContext context) + /// + public virtual async Task GetTransparencyConfigCborAsync(RequestContext context) { - Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntryStatus"); + using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetTransparencyConfigCbor"); scope.Start(); try { - using HttpMessage message = CreateGetEntryStatusRequest(operationId, context); + using HttpMessage message = CreateGetTransparencyConfigCborRequest(context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -115,7 +99,7 @@ public virtual async Task GetEntryStatusAsync(string operationId, Requ } /// - /// [Protocol Method] Get the status the entry operation + /// [Protocol Method] Get the transparency service configuration, mandatory in IETF SCITT draft /// /// /// @@ -124,27 +108,22 @@ public virtual async Task GetEntryStatusAsync(string operationId, Requ /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// ID of the operation to retrieve. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetEntryStatus(string operationId, RequestContext context) + /// + public virtual Response GetTransparencyConfigCbor(RequestContext context) { - Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntryStatus"); + using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetTransparencyConfigCbor"); scope.Start(); try { - using HttpMessage message = CreateGetEntryStatusRequest(operationId, context); + using HttpMessage message = CreateGetTransparencyConfigCborRequest(context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -154,28 +133,28 @@ public virtual Response GetEntryStatus(string operationId, RequestContext contex } } - /// Get the status of all entries operations. + /// Get the public keys used by the service to sign receipts, mentioned in IETF SCITT draft as part of jwks_uri implementation. /// The cancellation token to use. - /// - public virtual async Task> GetEntryStatusesAsync(CancellationToken cancellationToken = default) + /// + public virtual async Task> GetPublicKeysAsync(CancellationToken cancellationToken = default) { RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetEntryStatusesAsync(context).ConfigureAwait(false); - return Response.FromValue(ListOperationResult.FromResponse(response), response); + Response response = await GetPublicKeysAsync(context).ConfigureAwait(false); + return Response.FromValue(JwksDocument.FromResponse(response), response); } - /// Get the status of all entries operations. + /// Get the public keys used by the service to sign receipts, mentioned in IETF SCITT draft as part of jwks_uri implementation. /// The cancellation token to use. - /// - public virtual Response GetEntryStatuses(CancellationToken cancellationToken = default) + /// + public virtual Response GetPublicKeys(CancellationToken cancellationToken = default) { RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetEntryStatuses(context); - return Response.FromValue(ListOperationResult.FromResponse(response), response); + Response response = GetPublicKeys(context); + return Response.FromValue(JwksDocument.FromResponse(response), response); } /// - /// [Protocol Method] Get the status of all entries operations + /// [Protocol Method] Get the public keys used by the service to sign receipts, mentioned in IETF SCITT draft as part of jwks_uri implementation /// /// /// @@ -184,7 +163,7 @@ public virtual Response GetEntryStatuses(CancellationToken /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -192,14 +171,14 @@ public virtual Response GetEntryStatuses(CancellationToken /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetEntryStatusesAsync(RequestContext context) + /// + public virtual async Task GetPublicKeysAsync(RequestContext context) { - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntryStatuses"); + using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetPublicKeys"); scope.Start(); try { - using HttpMessage message = CreateGetEntryStatusesRequest(context); + using HttpMessage message = CreateGetPublicKeysRequest(context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -210,7 +189,7 @@ public virtual async Task GetEntryStatusesAsync(RequestContext context } /// - /// [Protocol Method] Get the status of all entries operations + /// [Protocol Method] Get the public keys used by the service to sign receipts, mentioned in IETF SCITT draft as part of jwks_uri implementation /// /// /// @@ -219,7 +198,7 @@ public virtual async Task GetEntryStatusesAsync(RequestContext context /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -227,14 +206,14 @@ public virtual async Task GetEntryStatusesAsync(RequestContext context /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetEntryStatuses(RequestContext context) + /// + public virtual Response GetPublicKeys(RequestContext context) { - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntryStatuses"); + using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetPublicKeys"); scope.Start(); try { - using HttpMessage message = CreateGetEntryStatusesRequest(context); + using HttpMessage message = CreateGetPublicKeysRequest(context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -244,40 +223,38 @@ public virtual Response GetEntryStatuses(RequestContext context) } } - /// Get Entry with or without receipt embedded in its unprotected header. - /// ID of the entry to retrieve. - /// Embed a receipt as part of the response. + /// Get status of the long running registration operation, mandatory in IETF SCITT draft. + /// ID of the operation to retrieve. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task> GetEntryAsync(string entryId, bool? embedReceipt = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetOperationAsync(string operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetEntryAsync(entryId, embedReceipt, context).ConfigureAwait(false); + Response response = await GetOperationAsync(operationId, context).ConfigureAwait(false); return Response.FromValue(response.Content, response); } - /// Get Entry with or without receipt embedded in its unprotected header. - /// ID of the entry to retrieve. - /// Embed a receipt as part of the response. + /// Get status of the long running registration operation, mandatory in IETF SCITT draft. + /// ID of the operation to retrieve. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Response GetEntry(string entryId, bool? embedReceipt = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetOperation(string operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetEntry(entryId, embedReceipt, context); + Response response = GetOperation(operationId, context); return Response.FromValue(response.Content, response); } /// - /// [Protocol Method] Get Entry with or without receipt embedded in its unprotected header + /// [Protocol Method] Get status of the long running registration operation, mandatory in IETF SCITT draft /// /// /// @@ -286,28 +263,27 @@ public virtual Response GetEntry(string entryId, bool? embedReceipt /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// ID of the entry to retrieve. - /// Embed a receipt as part of the response. + /// ID of the operation to retrieve. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetEntryAsync(string entryId, bool? embedReceipt, RequestContext context) + /// + public virtual async Task GetOperationAsync(string operationId, RequestContext context) { - Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntry"); + using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetOperation"); scope.Start(); try { - using HttpMessage message = CreateGetEntryRequest(entryId, embedReceipt, context); + using HttpMessage message = CreateGetOperationRequest(operationId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -318,7 +294,7 @@ public virtual async Task GetEntryAsync(string entryId, bool? embedRec } /// - /// [Protocol Method] Get Entry with or without receipt embedded in its unprotected header + /// [Protocol Method] Get status of the long running registration operation, mandatory in IETF SCITT draft /// /// /// @@ -327,28 +303,27 @@ public virtual async Task GetEntryAsync(string entryId, bool? embedRec /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// ID of the entry to retrieve. - /// Embed a receipt as part of the response. + /// ID of the operation to retrieve. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetEntry(string entryId, bool? embedReceipt, RequestContext context) + /// + public virtual Response GetOperation(string operationId, RequestContext context) { - Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntry"); + using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetOperation"); scope.Start(); try { - using HttpMessage message = CreateGetEntryRequest(entryId, embedReceipt, context); + using HttpMessage message = CreateGetOperationRequest(operationId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -358,38 +333,38 @@ public virtual Response GetEntry(string entryId, bool? embedReceipt, RequestCont } } - /// Get the receipt of an entry given a specific entry id. + /// Get receipt. /// ID of the entry to retrieve. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task> GetEntryReceiptAsync(string entryId, CancellationToken cancellationToken = default) + /// + public virtual async Task> GetEntryAsync(string entryId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetEntryReceiptAsync(entryId, context).ConfigureAwait(false); + Response response = await GetEntryAsync(entryId, context).ConfigureAwait(false); return Response.FromValue(response.Content, response); } - /// Get the receipt of an entry given a specific entry id. + /// Get receipt. /// ID of the entry to retrieve. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. - /// - public virtual Response GetEntryReceipt(string entryId, CancellationToken cancellationToken = default) + /// + public virtual Response GetEntry(string entryId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetEntryReceipt(entryId, context); + Response response = GetEntry(entryId, context); return Response.FromValue(response.Content, response); } /// - /// [Protocol Method] Get the receipt of an entry given a specific entry id. + /// [Protocol Method] Get receipt /// /// /// @@ -398,7 +373,7 @@ public virtual Response GetEntryReceipt(string entryId, Cancellation /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -409,16 +384,16 @@ public virtual Response GetEntryReceipt(string entryId, Cancellation /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetEntryReceiptAsync(string entryId, RequestContext context) + /// + public virtual async Task GetEntryAsync(string entryId, RequestContext context) { Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntryReceipt"); + using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntry"); scope.Start(); try { - using HttpMessage message = CreateGetEntryReceiptRequest(entryId, context); + using HttpMessage message = CreateGetEntryRequest(entryId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -429,7 +404,7 @@ public virtual async Task GetEntryReceiptAsync(string entryId, Request } /// - /// [Protocol Method] Get the receipt of an entry given a specific entry id. + /// [Protocol Method] Get receipt /// /// /// @@ -438,7 +413,7 @@ public virtual async Task GetEntryReceiptAsync(string entryId, Request /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -449,16 +424,16 @@ public virtual async Task GetEntryReceiptAsync(string entryId, Request /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetEntryReceipt(string entryId, RequestContext context) + /// + public virtual Response GetEntry(string entryId, RequestContext context) { Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntryReceipt"); + using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntry"); scope.Start(); try { - using HttpMessage message = CreateGetEntryReceiptRequest(entryId, context); + using HttpMessage message = CreateGetEntryRequest(entryId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -468,153 +443,38 @@ public virtual Response GetEntryReceipt(string entryId, RequestContext context) } } - /// Get service parameters. + /// Get the transparent statement consisting of the signed statement and the receipt embedded in the header. + /// ID of the entry to retrieve. /// The cancellation token to use. - /// - public virtual async Task> GetParametersAsync(CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetEntryStatementAsync(string entryId, CancellationToken cancellationToken = default) { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetParametersAsync(context).ConfigureAwait(false); - return Response.FromValue(ParametersResult.FromResponse(response), response); - } + Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); - /// Get service parameters. - /// The cancellation token to use. - /// - public virtual Response GetParameters(CancellationToken cancellationToken = default) - { RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetParameters(context); - return Response.FromValue(ParametersResult.FromResponse(response), response); - } - - /// - /// [Protocol Method] Get service parameters - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetParametersAsync(RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetParameters"); - scope.Start(); - try - { - using HttpMessage message = CreateGetParametersRequest(context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Get service parameters - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetParameters(RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetParameters"); - scope.Start(); - try - { - using HttpMessage message = CreateGetParametersRequest(context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + Response response = await GetEntryStatementAsync(entryId, context).ConfigureAwait(false); + return Response.FromValue(response.Content, response); } - /// Get the DID configuration file. + /// Get the transparent statement consisting of the signed statement and the receipt embedded in the header. + /// ID of the entry to retrieve. /// The cancellation token to use. - /// - public virtual async Task> GetDidConfigAsync(CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetEntryStatement(string entryId, CancellationToken cancellationToken = default) { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetDidConfigAsync(context).ConfigureAwait(false); - return Response.FromValue(DidDocument.FromResponse(response), response); - } + Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); - /// Get the DID configuration file. - /// The cancellation token to use. - /// - public virtual Response GetDidConfig(CancellationToken cancellationToken = default) - { RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetDidConfig(context); - return Response.FromValue(DidDocument.FromResponse(response), response); - } - - /// - /// [Protocol Method] Get the DID configuration file. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetDidConfigAsync(RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetDidConfig"); - scope.Start(); - try - { - using HttpMessage message = CreateGetDidConfigRequest(context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + Response response = GetEntryStatement(entryId, context); + return Response.FromValue(response.Content, response); } /// - /// [Protocol Method] Get the DID configuration file. + /// [Protocol Method] Get the transparent statement consisting of the signed statement and the receipt embedded in the header /// /// /// @@ -623,77 +483,27 @@ public virtual async Task GetDidConfigAsync(RequestContext context) /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// + /// ID of the entry to retrieve. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetDidConfig(RequestContext context) + /// + public virtual async Task GetEntryStatementAsync(string entryId, RequestContext context) { - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetDidConfig"); - scope.Start(); - try - { - using HttpMessage message = CreateGetDidConfigRequest(context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get CodeTransparency configuration information. - /// The cancellation token to use. - /// - public virtual async Task> GetCodeTransparencyConfigAsync(CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetCodeTransparencyConfigAsync(context).ConfigureAwait(false); - return Response.FromValue(CodeTransparencyConfiguration.FromResponse(response), response); - } - - /// Get CodeTransparency configuration information. - /// The cancellation token to use. - /// - public virtual Response GetCodeTransparencyConfig(CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetCodeTransparencyConfig(context); - return Response.FromValue(CodeTransparencyConfiguration.FromResponse(response), response); - } + Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); - /// - /// [Protocol Method] Get CodeTransparency configuration information. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetCodeTransparencyConfigAsync(RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetCodeTransparencyConfig"); + using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntryStatement"); scope.Start(); try { - using HttpMessage message = CreateGetCodeTransparencyConfigRequest(context); + using HttpMessage message = CreateGetEntryStatementRequest(entryId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -704,62 +514,7 @@ public virtual async Task GetCodeTransparencyConfigAsync(RequestContex } /// - /// [Protocol Method] Get CodeTransparency configuration information. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetCodeTransparencyConfig(RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetCodeTransparencyConfig"); - scope.Start(); - try - { - using HttpMessage message = CreateGetCodeTransparencyConfigRequest(context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get CodeTransparency version information. - /// The cancellation token to use. - /// - public virtual async Task> GetCodeTransparencyVersionAsync(CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetCodeTransparencyVersionAsync(context).ConfigureAwait(false); - return Response.FromValue(VersionResult.FromResponse(response), response); - } - - /// Get CodeTransparency version information. - /// The cancellation token to use. - /// - public virtual Response GetCodeTransparencyVersion(CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetCodeTransparencyVersion(context); - return Response.FromValue(VersionResult.FromResponse(response), response); - } - - /// - /// [Protocol Method] Get CodeTransparency version information. + /// [Protocol Method] Get the transparent statement consisting of the signed statement and the receipt embedded in the header /// /// /// @@ -768,57 +523,27 @@ public virtual Response GetCodeTransparencyVersion(CancellationTo /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// + /// ID of the entry to retrieve. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetCodeTransparencyVersionAsync(RequestContext context) + /// + public virtual Response GetEntryStatement(string entryId, RequestContext context) { - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetCodeTransparencyVersion"); - scope.Start(); - try - { - using HttpMessage message = CreateGetCodeTransparencyVersionRequest(context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } + Argument.AssertNotNullOrEmpty(entryId, nameof(entryId)); - /// - /// [Protocol Method] Get CodeTransparency version information. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetCodeTransparencyVersion(RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetCodeTransparencyVersion"); + using var scope = ClientDiagnostics.CreateScope("CodeTransparencyClient.GetEntryStatement"); scope.Start(); try { - using HttpMessage message = CreateGetCodeTransparencyVersionRequest(context); + using HttpMessage message = CreateGetEntryStatementRequest(entryId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -828,240 +553,77 @@ public virtual Response GetCodeTransparencyVersion(RequestContext context) } } - /// Historical query to get a list of entries of a given range. - /// Starting Transaction Id. - /// Ending Transaction Id. - /// The cancellation token to use. - /// - public virtual AsyncPageable GetEntryIdsAsync(long? @from = null, long? to = null, CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEntryIdsRequest(@from, to, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEntryIdsNextPageRequest(nextLink, @from, to, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => e.GetString(), ClientDiagnostics, _pipeline, "CodeTransparencyClient.GetEntryIds", "transactionIds", "nextLink", context); - } - - /// Historical query to get a list of entries of a given range. - /// Starting Transaction Id. - /// Ending Transaction Id. - /// The cancellation token to use. - /// - public virtual Pageable GetEntryIds(long? @from = null, long? to = null, CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEntryIdsRequest(@from, to, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEntryIdsNextPageRequest(nextLink, @from, to, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => e.GetString(), ClientDiagnostics, _pipeline, "CodeTransparencyClient.GetEntryIds", "transactionIds", "nextLink", context); - } - - /// - /// [Protocol Method] Historical query to get a list of entries of a given range - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Starting Transaction Id. - /// Ending Transaction Id. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetEntryIdsAsync(long? @from, long? to, RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEntryIdsRequest(@from, to, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEntryIdsNextPageRequest(nextLink, @from, to, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "CodeTransparencyClient.GetEntryIds", "transactionIds", "nextLink", context); - } - - /// - /// [Protocol Method] Historical query to get a list of entries of a given range - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// Starting Transaction Id. - /// Ending Transaction Id. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetEntryIds(long? @from, long? to, RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEntryIdsRequest(@from, to, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEntryIdsNextPageRequest(nextLink, @from, to, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "CodeTransparencyClient.GetEntryIds", "transactionIds", "nextLink", context); - } - - internal HttpMessage CreateGetEntryStatusRequest(string operationId, RequestContext context) + internal HttpMessage CreateGetTransparencyConfigCborRequest(RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier200500503); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/operations/", false); - uri.AppendPath(operationId, true); + uri.AppendPath("/.well-known/transparency-configuration", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Accept", "application/cbor"); return message; } - internal HttpMessage CreateGetEntryStatusesRequest(RequestContext context) + internal HttpMessage CreateGetPublicKeysRequest(RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier200400404429500503); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/operations", false); + uri.AppendPath("/jwks", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateGetEntryRequest(string entryId, bool? embedReceipt, RequestContext context) + internal HttpMessage CreateGetOperationRequest(string operationId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier200202400404429500503); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/entries/", false); - uri.AppendPath(entryId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); uri.AppendQuery("api-version", _apiVersion, true); - if (embedReceipt != null) - { - uri.AppendQuery("embedReceipt", embedReceipt.Value, true); - } request.Uri = uri; - request.Headers.Add("Accept", "application/cose"); + request.Headers.Add("Accept", "application/cbor"); return message; } - internal HttpMessage CreateGetEntryReceiptRequest(string entryId, RequestContext context) + internal HttpMessage CreateGetEntryRequest(string entryId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier200400404429500503); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/entries/", false); uri.AppendPath(entryId, true); - uri.AppendPath("/receipt", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/cbor"); - return message; - } - - internal HttpMessage CreateGetEntryIdsRequest(long? @from, long? to, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/entries/txIds", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (@from != null) - { - uri.AppendQuery("from", @from.Value, true); - } - if (to != null) - { - uri.AppendQuery("to", to.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetParametersRequest(RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/parameters", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetDidConfigRequest(RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/.well-known/did.json", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetCodeTransparencyConfigRequest(RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/configuration", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Accept", "application/cose"); return message; } - internal HttpMessage CreateGetCodeTransparencyVersionRequest(RequestContext context) + internal HttpMessage CreateGetEntryStatementRequest(string entryId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier200400404429500503); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/version", false); + uri.AppendPath("/entries/", false); + uri.AppendPath(entryId, true); + uri.AppendPath("/statement", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetEntryIdsNextPageRequest(string nextLink, long? @from, long? to, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Accept", "application/cose"); return message; } @@ -1076,7 +638,13 @@ internal static RequestContext FromCancellationToken(CancellationToken cancellat return new RequestContext() { CancellationToken = cancellationToken }; } - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier200500503; + private static ResponseClassifier ResponseClassifier200500503 => _responseClassifier200500503 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 500, 503 }); + private static ResponseClassifier _responseClassifier200400404429500503; + private static ResponseClassifier ResponseClassifier200400404429500503 => _responseClassifier200400404429500503 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 400, 404, 429, 500, 503 }); + private static ResponseClassifier _responseClassifier201202400404429500503; + private static ResponseClassifier ResponseClassifier201202400404429500503 => _responseClassifier201202400404429500503 ??= new StatusCodeClassifier(stackalloc ushort[] { 201, 202, 400, 404, 429, 500, 503 }); + private static ResponseClassifier _responseClassifier200202400404429500503; + private static ResponseClassifier ResponseClassifier200202400404429500503 => _responseClassifier200202400404429500503 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 202, 400, 404, 429, 500, 503 }); } } diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyClientOptions.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyClientOptions.cs index 34f941625bba..9ce33d7d3e67 100644 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyClientOptions.cs +++ b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyClientOptions.cs @@ -13,13 +13,13 @@ namespace Azure.Security.CodeTransparency /// Client options for CodeTransparencyClient. public partial class CodeTransparencyClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2024_01_11_Preview; + private const ServiceVersion LatestVersion = ServiceVersion.V2025_01_31_Preview; /// The version of the service to use. public enum ServiceVersion { - /// Service version "2024-01-11-preview". - V2024_01_11_Preview = 1, + /// Service version "2025-01-31-preview". + V2025_01_31_Preview = 1, } internal string Version { get; } @@ -29,7 +29,7 @@ public CodeTransparencyClientOptions(ServiceVersion version = LatestVersion) { Version = version switch { - ServiceVersion.V2024_01_11_Preview => "2024-01-11-preview", + ServiceVersion.V2025_01_31_Preview => "2025-01-31-preview", _ => throw new NotSupportedException() }; } diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfiguration.Serialization.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfiguration.Serialization.cs deleted file mode 100644 index 7634b3fb5214..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfiguration.Serialization.cs +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Security.CodeTransparency -{ - public partial class CodeTransparencyConfiguration : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeTransparencyConfiguration)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Policy)) - { - writer.WritePropertyName("policy"u8); - writer.WriteObjectValue(Policy, options); - } - if (Optional.IsDefined(Authentication)) - { - writer.WritePropertyName("authentication"u8); - writer.WriteObjectValue(Authentication, options); - } - if (Optional.IsDefined(ServiceIdentifier)) - { - writer.WritePropertyName("service_identifier"u8); - writer.WriteStringValue(ServiceIdentifier); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CodeTransparencyConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeTransparencyConfiguration)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeTransparencyConfiguration(document.RootElement, options); - } - - internal static CodeTransparencyConfiguration DeserializeCodeTransparencyConfiguration(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CodeTransparencyConfigurationPolicy policy = default; - CodeTransparencyConfigurationAuthentication authentication = default; - string serviceIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("policy"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - policy = CodeTransparencyConfigurationPolicy.DeserializeCodeTransparencyConfigurationPolicy(property.Value, options); - continue; - } - if (property.NameEquals("authentication"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - authentication = CodeTransparencyConfigurationAuthentication.DeserializeCodeTransparencyConfigurationAuthentication(property.Value, options); - continue; - } - if (property.NameEquals("service_identifier"u8)) - { - serviceIdentifier = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CodeTransparencyConfiguration(policy, authentication, serviceIdentifier, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(CodeTransparencyConfiguration)} does not support writing '{options.Format}' format."); - } - } - - CodeTransparencyConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeCodeTransparencyConfiguration(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CodeTransparencyConfiguration)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CodeTransparencyConfiguration FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCodeTransparencyConfiguration(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfiguration.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfiguration.cs deleted file mode 100644 index f0457a7dad24..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfiguration.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Security.CodeTransparency -{ - /// The Response body of the Configuration API. - public partial class CodeTransparencyConfiguration - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal CodeTransparencyConfiguration() - { - } - - /// Initializes a new instance of . - /// - /// - /// did:web identifier. - /// Keeps track of any properties unknown to the library. - internal CodeTransparencyConfiguration(CodeTransparencyConfigurationPolicy policy, CodeTransparencyConfigurationAuthentication authentication, string serviceIdentifier, IDictionary serializedAdditionalRawData) - { - Policy = policy; - Authentication = authentication; - ServiceIdentifier = serviceIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the policy. - public CodeTransparencyConfigurationPolicy Policy { get; } - /// Gets the authentication. - public CodeTransparencyConfigurationAuthentication Authentication { get; } - /// did:web identifier. - public string ServiceIdentifier { get; } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthentication.Serialization.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthentication.Serialization.cs deleted file mode 100644 index 9436dad133ed..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthentication.Serialization.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Security.CodeTransparency -{ - public partial class CodeTransparencyConfigurationAuthentication : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationAuthentication)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("allow_unauthenticated"u8); - writer.WriteBooleanValue(AllowUnauthenticated); - if (Optional.IsDefined(Jwt)) - { - writer.WritePropertyName("jwt"u8); - writer.WriteObjectValue(Jwt, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CodeTransparencyConfigurationAuthentication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationAuthentication)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeTransparencyConfigurationAuthentication(document.RootElement, options); - } - - internal static CodeTransparencyConfigurationAuthentication DeserializeCodeTransparencyConfigurationAuthentication(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool allowUnauthenticated = default; - CodeTransparencyConfigurationAuthenticationJwt jwt = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("allow_unauthenticated"u8)) - { - allowUnauthenticated = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("jwt"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - jwt = CodeTransparencyConfigurationAuthenticationJwt.DeserializeCodeTransparencyConfigurationAuthenticationJwt(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CodeTransparencyConfigurationAuthentication(allowUnauthenticated, jwt, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationAuthentication)} does not support writing '{options.Format}' format."); - } - } - - CodeTransparencyConfigurationAuthentication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeCodeTransparencyConfigurationAuthentication(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationAuthentication)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CodeTransparencyConfigurationAuthentication FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCodeTransparencyConfigurationAuthentication(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthentication.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthentication.cs deleted file mode 100644 index e1c87d448398..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthentication.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Security.CodeTransparency -{ - /// Configuration of CCF authentication. - public partial class CodeTransparencyConfigurationAuthentication - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// - internal CodeTransparencyConfigurationAuthentication(bool allowUnauthenticated) - { - AllowUnauthenticated = allowUnauthenticated; - } - - /// Initializes a new instance of . - /// - /// - /// Keeps track of any properties unknown to the library. - internal CodeTransparencyConfigurationAuthentication(bool allowUnauthenticated, CodeTransparencyConfigurationAuthenticationJwt jwt, IDictionary serializedAdditionalRawData) - { - AllowUnauthenticated = allowUnauthenticated; - Jwt = jwt; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CodeTransparencyConfigurationAuthentication() - { - } - - /// Gets the allow unauthenticated. - public bool AllowUnauthenticated { get; } - /// Gets the jwt. - public CodeTransparencyConfigurationAuthenticationJwt Jwt { get; } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthenticationJwt.Serialization.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthenticationJwt.Serialization.cs deleted file mode 100644 index fd05e2281125..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthenticationJwt.Serialization.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Security.CodeTransparency -{ - public partial class CodeTransparencyConfigurationAuthenticationJwt : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationAuthenticationJwt)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("required_claims"u8); - writer.WriteStartObject(); - foreach (var item in RequiredClaims) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CodeTransparencyConfigurationAuthenticationJwt IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationAuthenticationJwt)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeTransparencyConfigurationAuthenticationJwt(document.RootElement, options); - } - - internal static CodeTransparencyConfigurationAuthenticationJwt DeserializeCodeTransparencyConfigurationAuthenticationJwt(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary requiredClaims = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("required_claims"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - requiredClaims = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CodeTransparencyConfigurationAuthenticationJwt(requiredClaims, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationAuthenticationJwt)} does not support writing '{options.Format}' format."); - } - } - - CodeTransparencyConfigurationAuthenticationJwt IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeCodeTransparencyConfigurationAuthenticationJwt(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationAuthenticationJwt)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CodeTransparencyConfigurationAuthenticationJwt FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCodeTransparencyConfigurationAuthenticationJwt(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthenticationJwt.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthenticationJwt.cs deleted file mode 100644 index e8f3459a23f9..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationAuthenticationJwt.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Security.CodeTransparency -{ - /// Configuration of JWT claims. - public partial class CodeTransparencyConfigurationAuthenticationJwt - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// - /// is null. - internal CodeTransparencyConfigurationAuthenticationJwt(IReadOnlyDictionary requiredClaims) - { - Argument.AssertNotNull(requiredClaims, nameof(requiredClaims)); - - RequiredClaims = requiredClaims; - } - - /// Initializes a new instance of . - /// - /// Keeps track of any properties unknown to the library. - internal CodeTransparencyConfigurationAuthenticationJwt(IReadOnlyDictionary requiredClaims, IDictionary serializedAdditionalRawData) - { - RequiredClaims = requiredClaims; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CodeTransparencyConfigurationAuthenticationJwt() - { - } - - /// Gets the required claims. - public IReadOnlyDictionary RequiredClaims { get; } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationPolicy.Serialization.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationPolicy.Serialization.cs deleted file mode 100644 index 388eb54e4a52..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationPolicy.Serialization.cs +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Security.CodeTransparency -{ - public partial class CodeTransparencyConfigurationPolicy : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationPolicy)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(AcceptedAlgorithms)) - { - writer.WritePropertyName("accepted_algorithms"u8); - writer.WriteStartArray(); - foreach (var item in AcceptedAlgorithms) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(AcceptedDidIssuers)) - { - writer.WritePropertyName("accepted_did_issuers"u8); - writer.WriteStartArray(); - foreach (var item in AcceptedDidIssuers) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CodeTransparencyConfigurationPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationPolicy)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCodeTransparencyConfigurationPolicy(document.RootElement, options); - } - - internal static CodeTransparencyConfigurationPolicy DeserializeCodeTransparencyConfigurationPolicy(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList acceptedAlgorithms = default; - IReadOnlyList acceptedDidIssuers = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("accepted_algorithms"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - acceptedAlgorithms = array; - continue; - } - if (property.NameEquals("accepted_did_issuers"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - acceptedDidIssuers = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CodeTransparencyConfigurationPolicy(acceptedAlgorithms ?? new ChangeTrackingList(), acceptedDidIssuers ?? new ChangeTrackingList(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationPolicy)} does not support writing '{options.Format}' format."); - } - } - - CodeTransparencyConfigurationPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeCodeTransparencyConfigurationPolicy(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CodeTransparencyConfigurationPolicy)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CodeTransparencyConfigurationPolicy FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCodeTransparencyConfigurationPolicy(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationPolicy.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationPolicy.cs deleted file mode 100644 index a4f352778ca3..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CodeTransparencyConfigurationPolicy.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Security.CodeTransparency -{ - /// Configuration of CCF Authentication policies. - public partial class CodeTransparencyConfigurationPolicy - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal CodeTransparencyConfigurationPolicy() - { - AcceptedAlgorithms = new ChangeTrackingList(); - AcceptedDidIssuers = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// - /// - /// Keeps track of any properties unknown to the library. - internal CodeTransparencyConfigurationPolicy(IReadOnlyList acceptedAlgorithms, IReadOnlyList acceptedDidIssuers, IDictionary serializedAdditionalRawData) - { - AcceptedAlgorithms = acceptedAlgorithms; - AcceptedDidIssuers = acceptedDidIssuers; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the accepted algorithms. - public IReadOnlyList AcceptedAlgorithms { get; } - /// Gets the accepted did issuers. - public IReadOnlyList AcceptedDidIssuers { get; } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CreateEntryResult.Serialization.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CreateEntryResult.Serialization.cs deleted file mode 100644 index 9e3f955b7551..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CreateEntryResult.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Security.CodeTransparency -{ - public partial class CreateEntryResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateEntryResult)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("operationId"u8); - writer.WriteStringValue(OperationId); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CreateEntryResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CreateEntryResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateEntryResult(document.RootElement, options); - } - - internal static CreateEntryResult DeserializeCreateEntryResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string operationId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CreateEntryResult(operationId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(CreateEntryResult)} does not support writing '{options.Format}' format."); - } - } - - CreateEntryResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeCreateEntryResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CreateEntryResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CreateEntryResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCreateEntryResult(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CreateEntryResult.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CreateEntryResult.cs deleted file mode 100644 index 35a24b671ef9..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/CreateEntryResult.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Security.CodeTransparency -{ - /// Response of entry submission containing the operationId. - public partial class CreateEntryResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// String representing the operation id submitted. - /// is null. - internal CreateEntryResult(string operationId) - { - Argument.AssertNotNull(operationId, nameof(operationId)); - - OperationId = operationId; - } - - /// Initializes a new instance of . - /// String representing the operation id submitted. - /// Keeps track of any properties unknown to the library. - internal CreateEntryResult(string operationId, IDictionary serializedAdditionalRawData) - { - OperationId = operationId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CreateEntryResult() - { - } - - /// String representing the operation id submitted. - public string OperationId { get; } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocument.Serialization.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocument.Serialization.cs deleted file mode 100644 index 254ed4b610df..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocument.Serialization.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Security.CodeTransparency -{ - public partial class DidDocument : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(DidDocument)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("assertionMethod"u8); - writer.WriteStartArray(); - foreach (var item in AssertionMethod) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - DidDocument IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(DidDocument)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDidDocument(document.RootElement, options); - } - - internal static DidDocument DeserializeDidDocument(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - IReadOnlyList assertionMethod = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("assertionMethod"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DidDocumentKey.DeserializeDidDocumentKey(item, options)); - } - assertionMethod = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DidDocument(id, assertionMethod, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(DidDocument)} does not support writing '{options.Format}' format."); - } - } - - DidDocument IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeDidDocument(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DidDocument)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static DidDocument FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDidDocument(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocument.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocument.cs deleted file mode 100644 index 45e7ad37cd29..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocument.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.Security.CodeTransparency -{ - /// A DID document. - public partial class DidDocument - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// String representing a DID issuer. - /// List of public keys used for receipt endorsement verification. - /// or is null. - internal DidDocument(string id, IEnumerable assertionMethod) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(assertionMethod, nameof(assertionMethod)); - - Id = id; - AssertionMethod = assertionMethod.ToList(); - } - - /// Initializes a new instance of . - /// String representing a DID issuer. - /// List of public keys used for receipt endorsement verification. - /// Keeps track of any properties unknown to the library. - internal DidDocument(string id, IReadOnlyList assertionMethod, IDictionary serializedAdditionalRawData) - { - Id = id; - AssertionMethod = assertionMethod; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DidDocument() - { - } - - /// String representing a DID issuer. - public string Id { get; } - /// List of public keys used for receipt endorsement verification. - public IReadOnlyList AssertionMethod { get; } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocumentKey.Serialization.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocumentKey.Serialization.cs deleted file mode 100644 index dc81a9082218..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocumentKey.Serialization.cs +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Security.CodeTransparency -{ - public partial class DidDocumentKey : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(DidDocumentKey)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("controller"u8); - writer.WriteStringValue(Controller); - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type.ToString()); - writer.WritePropertyName("publicKeyJwk"u8); - writer.WriteObjectValue(PublicKeyJwk, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - DidDocumentKey IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(DidDocumentKey)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDidDocumentKey(document.RootElement, options); - } - - internal static DidDocumentKey DeserializeDidDocumentKey(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string controller = default; - DidDocumentKeyType type = default; - JsonWebKey publicKeyJwk = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("controller"u8)) - { - controller = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new DidDocumentKeyType(property.Value.GetString()); - continue; - } - if (property.NameEquals("publicKeyJwk"u8)) - { - publicKeyJwk = JsonWebKey.DeserializeJsonWebKey(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new DidDocumentKey(id, controller, type, publicKeyJwk, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(DidDocumentKey)} does not support writing '{options.Format}' format."); - } - } - - DidDocumentKey IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeDidDocumentKey(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DidDocumentKey)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static DidDocumentKey FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDidDocumentKey(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocumentKey.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocumentKey.cs deleted file mode 100644 index 4c959e28c237..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocumentKey.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Security.CodeTransparency -{ - /// A DID document key. - public partial class DidDocumentKey - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Key identifier. - /// Key controller - similar to DID issuer. - /// Serialized public key in JWK format. - /// , or is null. - internal DidDocumentKey(string id, string controller, JsonWebKey publicKeyJwk) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(controller, nameof(controller)); - Argument.AssertNotNull(publicKeyJwk, nameof(publicKeyJwk)); - - Id = id; - Controller = controller; - PublicKeyJwk = publicKeyJwk; - } - - /// Initializes a new instance of . - /// Key identifier. - /// Key controller - similar to DID issuer. - /// Key type. - /// Serialized public key in JWK format. - /// Keeps track of any properties unknown to the library. - internal DidDocumentKey(string id, string controller, DidDocumentKeyType type, JsonWebKey publicKeyJwk, IDictionary serializedAdditionalRawData) - { - Id = id; - Controller = controller; - Type = type; - PublicKeyJwk = publicKeyJwk; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DidDocumentKey() - { - } - - /// Key identifier. - public string Id { get; } - /// Key controller - similar to DID issuer. - public string Controller { get; } - /// Key type. - public DidDocumentKeyType Type { get; } = DidDocumentKeyType.JsonWebKey2020; - - /// Serialized public key in JWK format. - public JsonWebKey PublicKeyJwk { get; } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocumentKeyType.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocumentKeyType.cs deleted file mode 100644 index 7f3ae63215fc..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/DidDocumentKeyType.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Security.CodeTransparency -{ - /// The DidDocumentKey_type. - public readonly partial struct DidDocumentKeyType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public DidDocumentKeyType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string JsonWebKey2020Value = "JsonWebKey2020"; - - /// JsonWebKey2020. - public static DidDocumentKeyType JsonWebKey2020 { get; } = new DidDocumentKeyType(JsonWebKey2020Value); - /// Determines if two values are the same. - public static bool operator ==(DidDocumentKeyType left, DidDocumentKeyType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(DidDocumentKeyType left, DidDocumentKeyType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator DidDocumentKeyType(string value) => new DidDocumentKeyType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is DidDocumentKeyType other && Equals(other); - /// - public bool Equals(DidDocumentKeyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/Docs/CodeTransparencyClient.xml b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/Docs/CodeTransparencyClient.xml index 193a8fab888f..33841852c195 100644 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/Docs/CodeTransparencyClient.xml +++ b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/Docs/CodeTransparencyClient.xml @@ -1,478 +1,254 @@ - + -This sample shows how to call GetEntryStatusAsync. +This sample shows how to call GetTransparencyConfigCborAsync. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = await client.GetEntryStatusAsync("2.123"); +Response response = await client.GetTransparencyConfigCborAsync(); ]]> - + -This sample shows how to call GetEntryStatus. +This sample shows how to call GetTransparencyConfigCbor. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = client.GetEntryStatus("2.123"); +Response response = client.GetTransparencyConfigCbor(); ]]> - + -This sample shows how to call GetEntryStatusAsync and parse the result. +This sample shows how to call GetTransparencyConfigCborAsync and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = await client.GetEntryStatusAsync("2.123", null); +Response response = await client.GetTransparencyConfigCborAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("operationId").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.ToString()); ]]> - + -This sample shows how to call GetEntryStatus and parse the result. +This sample shows how to call GetTransparencyConfigCbor and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = client.GetEntryStatus("2.123", null); +Response response = client.GetTransparencyConfigCbor(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("operationId").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.ToString()); ]]> - + -This sample shows how to call GetEntryStatusesAsync. +This sample shows how to call GetPublicKeysAsync. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = await client.GetEntryStatusesAsync(); +Response response = await client.GetPublicKeysAsync(); ]]> - + -This sample shows how to call GetEntryStatuses. +This sample shows how to call GetPublicKeys. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = client.GetEntryStatuses(); +Response response = client.GetPublicKeys(); ]]> - + -This sample shows how to call GetEntryStatusesAsync and parse the result. +This sample shows how to call GetPublicKeysAsync and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = await client.GetEntryStatusesAsync(null); +Response response = await client.GetPublicKeysAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("operationId").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("keys")[0].GetProperty("kty").ToString()); ]]> - + -This sample shows how to call GetEntryStatuses and parse the result. +This sample shows how to call GetPublicKeys and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = client.GetEntryStatuses(null); +Response response = client.GetPublicKeys(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("operationId").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("keys")[0].GetProperty("kty").ToString()); ]]> - + -This sample shows how to call GetEntryAsync. +This sample shows how to call GetOperationAsync. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = await client.GetEntryAsync("2.131"); +Response response = await client.GetOperationAsync("2.131"); ]]> - + -This sample shows how to call GetEntry. +This sample shows how to call GetOperation. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = client.GetEntry("2.131"); +Response response = client.GetOperation("2.131"); ]]> - + -This sample shows how to call GetEntryAsync and parse the result. +This sample shows how to call GetOperationAsync and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = await client.GetEntryAsync("2.131", null, null); +Response response = await client.GetOperationAsync("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - + -This sample shows how to call GetEntry and parse the result. +This sample shows how to call GetOperation and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = client.GetEntry("2.131", null, null); +Response response = client.GetOperation("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - + -This sample shows how to call GetEntryReceiptAsync. +This sample shows how to call GetEntryAsync. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = await client.GetEntryReceiptAsync("2.131"); +Response response = await client.GetEntryAsync("2.131"); ]]> - + -This sample shows how to call GetEntryReceipt. +This sample shows how to call GetEntry. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = client.GetEntryReceipt("2.131"); +Response response = client.GetEntry("2.131"); ]]> - + -This sample shows how to call GetEntryReceiptAsync and parse the result. +This sample shows how to call GetEntryAsync and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = await client.GetEntryReceiptAsync("2.131", null); +Response response = await client.GetEntryAsync("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - + -This sample shows how to call GetEntryReceipt and parse the result. +This sample shows how to call GetEntry and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = client.GetEntryReceipt("2.131", null); +Response response = client.GetEntry("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - - -This sample shows how to call GetParametersAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = await client.GetParametersAsync(); -]]> - - - -This sample shows how to call GetParameters. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = client.GetParameters(); -]]> - - - -This sample shows how to call GetParametersAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = await client.GetParametersAsync(null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("serviceCertificate").ToString()); -Console.WriteLine(result.GetProperty("serviceId").ToString()); -Console.WriteLine(result.GetProperty("signatureAlgorithm").ToString()); -Console.WriteLine(result.GetProperty("treeAlgorithm").ToString()); -]]> - - - -This sample shows how to call GetParameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = client.GetParameters(null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("serviceCertificate").ToString()); -Console.WriteLine(result.GetProperty("serviceId").ToString()); -Console.WriteLine(result.GetProperty("signatureAlgorithm").ToString()); -Console.WriteLine(result.GetProperty("treeAlgorithm").ToString()); -]]> - - - -This sample shows how to call GetDidConfigAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = await client.GetDidConfigAsync(); -]]> - - - -This sample shows how to call GetDidConfig. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = client.GetDidConfig(); -]]> - - - -This sample shows how to call GetDidConfigAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = await client.GetDidConfigAsync(null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("controller").ToString()); -Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("publicKeyJwk").GetProperty("kty").ToString()); -]]> - - - -This sample shows how to call GetDidConfig and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = client.GetDidConfig(null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("controller").ToString()); -Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("publicKeyJwk").GetProperty("kty").ToString()); -]]> - - + -This sample shows how to call GetCodeTransparencyConfigAsync. +This sample shows how to call GetEntryStatementAsync. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = await client.GetCodeTransparencyConfigAsync(); +Response response = await client.GetEntryStatementAsync("2.131"); ]]> - + -This sample shows how to call GetCodeTransparencyConfig. +This sample shows how to call GetEntryStatement. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = client.GetCodeTransparencyConfig(); +Response response = client.GetEntryStatement("2.131"); ]]> - + -This sample shows how to call GetCodeTransparencyConfigAsync and parse the result. +This sample shows how to call GetEntryStatementAsync and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = await client.GetCodeTransparencyConfigAsync(null); +Response response = await client.GetEntryStatementAsync("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - + -This sample shows how to call GetCodeTransparencyConfig and parse the result. +This sample shows how to call GetEntryStatement and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); -Response response = client.GetCodeTransparencyConfig(null); +Response response = client.GetEntryStatement("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); -]]> - - - -This sample shows how to call GetCodeTransparencyVersionAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = await client.GetCodeTransparencyVersionAsync(); -]]> - - - -This sample shows how to call GetCodeTransparencyVersion. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = client.GetCodeTransparencyVersion(); -]]> - - - -This sample shows how to call GetCodeTransparencyVersionAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = await client.GetCodeTransparencyVersionAsync(null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("scitt_version").ToString()); -]]> - - - -This sample shows how to call GetCodeTransparencyVersion and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -Response response = client.GetCodeTransparencyVersion(null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("scitt_version").ToString()); -]]> - - - -This sample shows how to call GetEntryIdsAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -await foreach (string item in client.GetEntryIdsAsync()) -{ -} -]]> - - - -This sample shows how to call GetEntryIds. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -foreach (string item in client.GetEntryIds()) -{ -} -]]> - - - -This sample shows how to call GetEntryIdsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -await foreach (BinaryData item in client.GetEntryIdsAsync(null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); -} -]]> - - - -This sample shows how to call GetEntryIds and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - -foreach (BinaryData item in client.GetEntryIds(null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); -} ]]> diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/GetOperationResult.Serialization.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/GetOperationResult.Serialization.cs deleted file mode 100644 index a9aba1693c8c..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/GetOperationResult.Serialization.cs +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Security.CodeTransparency -{ - public partial class GetOperationResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(GetOperationResult)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(EntryId)) - { - writer.WritePropertyName("entryId"u8); - writer.WriteStringValue(EntryId); - } - if (Optional.IsDefined(Error)) - { - writer.WritePropertyName("error"u8); - writer.WriteStringValue(Error); - } - writer.WritePropertyName("operationId"u8); - writer.WriteStringValue(OperationId); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - GetOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(GetOperationResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeGetOperationResult(document.RootElement, options); - } - - internal static GetOperationResult DeserializeGetOperationResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string entryId = default; - string error = default; - string operationId = default; - OperationStatus status = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("entryId"u8)) - { - entryId = property.Value.GetString(); - continue; - } - if (property.NameEquals("error"u8)) - { - error = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationId"u8)) - { - operationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new OperationStatus(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new GetOperationResult(entryId, error, operationId, status, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(GetOperationResult)} does not support writing '{options.Format}' format."); - } - } - - GetOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeGetOperationResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(GetOperationResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static GetOperationResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeGetOperationResult(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/GetOperationResult.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/GetOperationResult.cs deleted file mode 100644 index ae1ba5386228..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/GetOperationResult.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Security.CodeTransparency -{ - /// The Response body of the GetOperationId API. - public partial class GetOperationResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// OperationId. - /// Status of the operation. - /// is null. - internal GetOperationResult(string operationId, OperationStatus status) - { - Argument.AssertNotNull(operationId, nameof(operationId)); - - OperationId = operationId; - Status = status; - } - - /// Initializes a new instance of . - /// ID of the transaction. Only if status is Succeeded. - /// Error in json format. Only if Status is Failed. - /// OperationId. - /// Status of the operation. - /// Keeps track of any properties unknown to the library. - internal GetOperationResult(string entryId, string error, string operationId, OperationStatus status, IDictionary serializedAdditionalRawData) - { - EntryId = entryId; - Error = error; - OperationId = operationId; - Status = status; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal GetOperationResult() - { - } - - /// ID of the transaction. Only if status is Succeeded. - public string EntryId { get; } - /// Error in json format. Only if Status is Failed. - public string Error { get; } - /// OperationId. - public string OperationId { get; } - /// Status of the operation. - public OperationStatus Status { get; } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ListOperationResult.Serialization.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/JwksDocument.Serialization.cs similarity index 61% rename from sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ListOperationResult.Serialization.cs rename to sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/JwksDocument.Serialization.cs index 33d52c80001c..34621fcf8e07 100644 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ListOperationResult.Serialization.cs +++ b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/JwksDocument.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.Security.CodeTransparency { - public partial class ListOperationResult : IUtf8JsonSerializable, IJsonModel + public partial class JwksDocument : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,15 +28,15 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ListOperationResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(JwksDocument)} does not support writing '{format}' format."); } - writer.WritePropertyName("operations"u8); + writer.WritePropertyName("keys"u8); writer.WriteStartArray(); - foreach (var item in Operations) + foreach (var item in Keys) { writer.WriteObjectValue(item, options); } @@ -58,19 +58,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ListOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + JwksDocument IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ListOperationResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(JwksDocument)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeListOperationResult(document.RootElement, options); + return DeserializeJwksDocument(document.RootElement, options); } - internal static ListOperationResult DeserializeListOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static JwksDocument DeserializeJwksDocument(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -78,19 +78,19 @@ internal static ListOperationResult DeserializeListOperationResult(JsonElement e { return null; } - IReadOnlyList operations = default; + IReadOnlyList keys = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operations"u8)) + if (property.NameEquals("keys"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(GetOperationResult.DeserializeGetOperationResult(item, options)); + array.Add(JsonWebKey.DeserializeJsonWebKey(item, options)); } - operations = array; + keys = array; continue; } if (options.Format != "W") @@ -99,46 +99,46 @@ internal static ListOperationResult DeserializeListOperationResult(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new ListOperationResult(operations, serializedAdditionalRawData); + return new JwksDocument(keys, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(ListOperationResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(JwksDocument)} does not support writing '{options.Format}' format."); } } - ListOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + JwksDocument IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeListOperationResult(document.RootElement, options); + return DeserializeJwksDocument(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ListOperationResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(JwksDocument)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static ListOperationResult FromResponse(Response response) + internal static JwksDocument FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeListOperationResult(document.RootElement); + return DeserializeJwksDocument(document.RootElement); } /// Convert into a . diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/VersionResult.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/JwksDocument.cs similarity index 63% rename from sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/VersionResult.cs rename to sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/JwksDocument.cs index 3f6a977a143f..64538ddc8825 100644 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/VersionResult.cs +++ b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/JwksDocument.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.Security.CodeTransparency { - /// The Response body of the Version API. - public partial class VersionResult + /// A JWKS like document. + public partial class JwksDocument { /// /// Keeps track of any properties unknown to the library. @@ -45,31 +46,31 @@ public partial class VersionResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Version of the CodeTransparency service. - /// is null. - internal VersionResult(string scittVersion) + /// Initializes a new instance of . + /// List of public keys used for receipt verification. + /// is null. + internal JwksDocument(IEnumerable keys) { - Argument.AssertNotNull(scittVersion, nameof(scittVersion)); + Argument.AssertNotNull(keys, nameof(keys)); - ScittVersion = scittVersion; + Keys = keys.ToList(); } - /// Initializes a new instance of . - /// Version of the CodeTransparency service. + /// Initializes a new instance of . + /// List of public keys used for receipt verification. /// Keeps track of any properties unknown to the library. - internal VersionResult(string scittVersion, IDictionary serializedAdditionalRawData) + internal JwksDocument(IReadOnlyList keys, IDictionary serializedAdditionalRawData) { - ScittVersion = scittVersion; + Keys = keys; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal VersionResult() + /// Initializes a new instance of for deserialization. + internal JwksDocument() { } - /// Version of the CodeTransparency service. - public string ScittVersion { get; } + /// List of public keys used for receipt verification. + public IReadOnlyList Keys { get; } } } diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ListOperationResult.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ListOperationResult.cs deleted file mode 100644 index 707eb569d8db..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ListOperationResult.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.Security.CodeTransparency -{ - /// The Response body of the ListOperations API. - public partial class ListOperationResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// List of operations. - /// is null. - internal ListOperationResult(IEnumerable operations) - { - Argument.AssertNotNull(operations, nameof(operations)); - - Operations = operations.ToList(); - } - - /// Initializes a new instance of . - /// List of operations. - /// Keeps track of any properties unknown to the library. - internal ListOperationResult(IReadOnlyList operations, IDictionary serializedAdditionalRawData) - { - Operations = operations; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ListOperationResult() - { - } - - /// List of operations. - public IReadOnlyList Operations { get; } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/OperationStatus.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/OperationStatus.cs deleted file mode 100644 index 7d785267bed1..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/OperationStatus.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Security.CodeTransparency -{ - /// Possible statuses of the operation. - public readonly partial struct OperationStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public OperationStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string RunningValue = "running"; - private const string FailedValue = "failed"; - private const string SucceededValue = "succeeded"; - - /// Operation is still running. - public static OperationStatus Running { get; } = new OperationStatus(RunningValue); - /// Operation failed. - public static OperationStatus Failed { get; } = new OperationStatus(FailedValue); - /// Operation succeeded. - public static OperationStatus Succeeded { get; } = new OperationStatus(SucceededValue); - /// Determines if two values are the same. - public static bool operator ==(OperationStatus left, OperationStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(OperationStatus left, OperationStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator OperationStatus(string value) => new OperationStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is OperationStatus other && Equals(other); - /// - public bool Equals(OperationStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ParametersResult.Serialization.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ParametersResult.Serialization.cs deleted file mode 100644 index d3f6a835c798..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ParametersResult.Serialization.cs +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Security.CodeTransparency -{ - public partial class ParametersResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ParametersResult)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("serviceCertificate"u8); - writer.WriteStringValue(ServiceCertificate); - writer.WritePropertyName("serviceId"u8); - writer.WriteStringValue(ServiceId); - writer.WritePropertyName("signatureAlgorithm"u8); - writer.WriteStringValue(SignatureAlgorithm); - writer.WritePropertyName("treeAlgorithm"u8); - writer.WriteStringValue(TreeAlgorithm); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ParametersResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ParametersResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeParametersResult(document.RootElement, options); - } - - internal static ParametersResult DeserializeParametersResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string serviceCertificate = default; - string serviceId = default; - string signatureAlgorithm = default; - string treeAlgorithm = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("serviceCertificate"u8)) - { - serviceCertificate = property.Value.GetString(); - continue; - } - if (property.NameEquals("serviceId"u8)) - { - serviceId = property.Value.GetString(); - continue; - } - if (property.NameEquals("signatureAlgorithm"u8)) - { - signatureAlgorithm = property.Value.GetString(); - continue; - } - if (property.NameEquals("treeAlgorithm"u8)) - { - treeAlgorithm = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ParametersResult(serviceCertificate, serviceId, signatureAlgorithm, treeAlgorithm, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(ParametersResult)} does not support writing '{options.Format}' format."); - } - } - - ParametersResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeParametersResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ParametersResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ParametersResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeParametersResult(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ParametersResult.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ParametersResult.cs deleted file mode 100644 index bfe505d3a084..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/ParametersResult.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.Security.CodeTransparency -{ - /// The Response body of the service parameters. - public partial class ParametersResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// - /// - /// - /// - /// , , or is null. - internal ParametersResult(string serviceCertificate, string serviceId, string signatureAlgorithm, string treeAlgorithm) - { - Argument.AssertNotNull(serviceCertificate, nameof(serviceCertificate)); - Argument.AssertNotNull(serviceId, nameof(serviceId)); - Argument.AssertNotNull(signatureAlgorithm, nameof(signatureAlgorithm)); - Argument.AssertNotNull(treeAlgorithm, nameof(treeAlgorithm)); - - ServiceCertificate = serviceCertificate; - ServiceId = serviceId; - SignatureAlgorithm = signatureAlgorithm; - TreeAlgorithm = treeAlgorithm; - } - - /// Initializes a new instance of . - /// - /// - /// - /// - /// Keeps track of any properties unknown to the library. - internal ParametersResult(string serviceCertificate, string serviceId, string signatureAlgorithm, string treeAlgorithm, IDictionary serializedAdditionalRawData) - { - ServiceCertificate = serviceCertificate; - ServiceId = serviceId; - SignatureAlgorithm = signatureAlgorithm; - TreeAlgorithm = treeAlgorithm; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ParametersResult() - { - } - - /// Gets the service certificate. - public string ServiceCertificate { get; } - /// Gets the service id. - public string ServiceId { get; } - /// Gets the signature algorithm. - public string SignatureAlgorithm { get; } - /// Gets the tree algorithm. - public string TreeAlgorithm { get; } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/SecurityCodeTransparencyModelFactory.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/SecurityCodeTransparencyModelFactory.cs index fd78223fa192..0dfb3f68ef5d 100644 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/SecurityCodeTransparencyModelFactory.cs +++ b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/SecurityCodeTransparencyModelFactory.cs @@ -13,66 +13,14 @@ namespace Azure.Security.CodeTransparency /// Model factory for models. public static partial class SecurityCodeTransparencyModelFactory { - /// Initializes a new instance of . - /// String representing the operation id submitted. - /// A new instance for mocking. - public static CreateEntryResult CreateEntryResult(string operationId = null) + /// Initializes a new instance of . + /// List of public keys used for receipt verification. + /// A new instance for mocking. + public static JwksDocument JwksDocument(IEnumerable keys = null) { - return new CreateEntryResult(operationId, serializedAdditionalRawData: null); - } + keys ??= new List(); - /// Initializes a new instance of . - /// ID of the transaction. Only if status is Succeeded. - /// Error in json format. Only if Status is Failed. - /// OperationId. - /// Status of the operation. - /// A new instance for mocking. - public static GetOperationResult GetOperationResult(string entryId = null, string error = null, string operationId = null, OperationStatus status = default) - { - return new GetOperationResult(entryId, error, operationId, status, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// List of operations. - /// A new instance for mocking. - public static ListOperationResult ListOperationResult(IEnumerable operations = null) - { - operations ??= new List(); - - return new ListOperationResult(operations?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// - /// - /// - /// A new instance for mocking. - public static ParametersResult ParametersResult(string serviceCertificate = null, string serviceId = null, string signatureAlgorithm = null, string treeAlgorithm = null) - { - return new ParametersResult(serviceCertificate, serviceId, signatureAlgorithm, treeAlgorithm, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// String representing a DID issuer. - /// List of public keys used for receipt endorsement verification. - /// A new instance for mocking. - public static DidDocument DidDocument(string id = null, IEnumerable assertionMethod = null) - { - assertionMethod ??= new List(); - - return new DidDocument(id, assertionMethod?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Key identifier. - /// Key controller - similar to DID issuer. - /// Key type. - /// Serialized public key in JWK format. - /// A new instance for mocking. - public static DidDocumentKey DidDocumentKey(string id = null, string controller = null, DidDocumentKeyType type = default, JsonWebKey publicKeyJwk = null) - { - return new DidDocumentKey(id, controller, type, publicKeyJwk, serializedAdditionalRawData: null); + return new JwksDocument(keys?.ToList(), serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -153,54 +101,5 @@ public static JsonWebKey JsonWebKey(string alg = null, string crv = null, string y, serializedAdditionalRawData: null); } - - /// Initializes a new instance of . - /// - /// - /// did:web identifier. - /// A new instance for mocking. - public static CodeTransparencyConfiguration CodeTransparencyConfiguration(CodeTransparencyConfigurationPolicy policy = null, CodeTransparencyConfigurationAuthentication authentication = null, string serviceIdentifier = null) - { - return new CodeTransparencyConfiguration(policy, authentication, serviceIdentifier, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// - /// A new instance for mocking. - public static CodeTransparencyConfigurationPolicy CodeTransparencyConfigurationPolicy(IEnumerable acceptedAlgorithms = null, IEnumerable acceptedDidIssuers = null) - { - acceptedAlgorithms ??= new List(); - acceptedDidIssuers ??= new List(); - - return new CodeTransparencyConfigurationPolicy(acceptedAlgorithms?.ToList(), acceptedDidIssuers?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// - /// A new instance for mocking. - public static CodeTransparencyConfigurationAuthentication CodeTransparencyConfigurationAuthentication(bool allowUnauthenticated = default, CodeTransparencyConfigurationAuthenticationJwt jwt = null) - { - return new CodeTransparencyConfigurationAuthentication(allowUnauthenticated, jwt, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// A new instance for mocking. - public static CodeTransparencyConfigurationAuthenticationJwt CodeTransparencyConfigurationAuthenticationJwt(IReadOnlyDictionary requiredClaims = null) - { - requiredClaims ??= new Dictionary(); - - return new CodeTransparencyConfigurationAuthenticationJwt(requiredClaims, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Version of the CodeTransparency service. - /// A new instance for mocking. - public static VersionResult VersionResult(string scittVersion = null) - { - return new VersionResult(scittVersion, serializedAdditionalRawData: null); - } } } diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/VersionResult.Serialization.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/VersionResult.Serialization.cs deleted file mode 100644 index eabcd7a41162..000000000000 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/src/Generated/VersionResult.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Security.CodeTransparency -{ - public partial class VersionResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(VersionResult)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("scitt_version"u8); - writer.WriteStringValue(ScittVersion); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - VersionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(VersionResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeVersionResult(document.RootElement, options); - } - - internal static VersionResult DeserializeVersionResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string scittVersion = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("scitt_version"u8)) - { - scittVersion = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new VersionResult(scittVersion, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(VersionResult)} does not support writing '{options.Format}' format."); - } - } - - VersionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeVersionResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(VersionResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static VersionResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeVersionResult(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/tests/Generated/Samples/Samples_CodeTransparencyClient.cs b/sdk/confidentialledger/Azure.Security.CodeTransparency/tests/Generated/Samples/Samples_CodeTransparencyClient.cs index 34e71d072ab7..e4dfbc1f562b 100644 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/tests/Generated/Samples/Samples_CodeTransparencyClient.cs +++ b/sdk/confidentialledger/Azure.Security.CodeTransparency/tests/Generated/Samples/Samples_CodeTransparencyClient.cs @@ -17,117 +17,113 @@ public partial class Samples_CodeTransparencyClient { [Test] [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetEntryStatus_GetEntryStatus() + public void Example_CodeTransparency_GetTransparencyConfigCbor_GetTransparencyConfigCbor() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = client.GetEntryStatus("2.123", null); + Response response = client.GetTransparencyConfigCbor(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("operationId").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetEntryStatus_GetEntryStatus_Async() + public async Task Example_CodeTransparency_GetTransparencyConfigCbor_GetTransparencyConfigCbor_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = await client.GetEntryStatusAsync("2.123", null); + Response response = await client.GetTransparencyConfigCborAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("operationId").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetEntryStatus_GetEntryStatus_Convenience() + public void Example_CodeTransparency_GetTransparencyConfigCbor_GetTransparencyConfigCbor_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = client.GetEntryStatus("2.123"); + Response response = client.GetTransparencyConfigCbor(); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetEntryStatus_GetEntryStatus_Convenience_Async() + public async Task Example_CodeTransparency_GetTransparencyConfigCbor_GetTransparencyConfigCbor_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = await client.GetEntryStatusAsync("2.123"); + Response response = await client.GetTransparencyConfigCborAsync(); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetEntryStatuses_ListEntryStatuses() + public void Example_CodeTransparency_GetPublicKeys_GetPublicKeys() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = client.GetEntryStatuses(null); + Response response = client.GetPublicKeys(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("operations")[0].GetProperty("operationId").ToString()); - Console.WriteLine(result.GetProperty("operations")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("keys")[0].GetProperty("kty").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetEntryStatuses_ListEntryStatuses_Async() + public async Task Example_CodeTransparency_GetPublicKeys_GetPublicKeys_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = await client.GetEntryStatusesAsync(null); + Response response = await client.GetPublicKeysAsync(null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("operations")[0].GetProperty("operationId").ToString()); - Console.WriteLine(result.GetProperty("operations")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("keys")[0].GetProperty("kty").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetEntryStatuses_ListEntryStatuses_Convenience() + public void Example_CodeTransparency_GetPublicKeys_GetPublicKeys_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = client.GetEntryStatuses(); + Response response = client.GetPublicKeys(); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetEntryStatuses_ListEntryStatuses_Convenience_Async() + public async Task Example_CodeTransparency_GetPublicKeys_GetPublicKeys_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = await client.GetEntryStatusesAsync(); + Response response = await client.GetPublicKeysAsync(); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetEntry_GetEntry() + public void Example_CodeTransparency_GetOperation_GetOperation() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = client.GetEntry("2.131", null, null); + Response response = client.GetOperation("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -135,13 +131,13 @@ public void Example_CodeTransparency_GetEntry_GetEntry() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetEntry_GetEntry_Async() + public async Task Example_CodeTransparency_GetOperation_GetOperation_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = await client.GetEntryAsync("2.131", null, null); + Response response = await client.GetOperationAsync("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -149,35 +145,35 @@ public async Task Example_CodeTransparency_GetEntry_GetEntry_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetEntry_GetEntry_Convenience() + public void Example_CodeTransparency_GetOperation_GetOperation_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = client.GetEntry("2.131"); + Response response = client.GetOperation("2.131"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetEntry_GetEntry_Convenience_Async() + public async Task Example_CodeTransparency_GetOperation_GetOperation_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = await client.GetEntryAsync("2.131"); + Response response = await client.GetOperationAsync("2.131"); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetEntryReceipt_GetEntryReceipt() + public void Example_CodeTransparency_GetEntry_GetEntry() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = client.GetEntryReceipt("2.131", null); + Response response = client.GetEntry("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -185,13 +181,13 @@ public void Example_CodeTransparency_GetEntryReceipt_GetEntryReceipt() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetEntryReceipt_GetEntryReceipt_Async() + public async Task Example_CodeTransparency_GetEntry_GetEntry_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = await client.GetEntryReceiptAsync("2.131", null); + Response response = await client.GetEntryAsync("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -199,149 +195,35 @@ public async Task Example_CodeTransparency_GetEntryReceipt_GetEntryReceipt_Async [Test] [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetEntryReceipt_GetEntryReceipt_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = client.GetEntryReceipt("2.131"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetEntryReceipt_GetEntryReceipt_Convenience_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = await client.GetEntryReceiptAsync("2.131"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetParameters_GetParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = client.GetParameters(null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("serviceCertificate").ToString()); - Console.WriteLine(result.GetProperty("serviceId").ToString()); - Console.WriteLine(result.GetProperty("signatureAlgorithm").ToString()); - Console.WriteLine(result.GetProperty("treeAlgorithm").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetParameters_GetParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = await client.GetParametersAsync(null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("serviceCertificate").ToString()); - Console.WriteLine(result.GetProperty("serviceId").ToString()); - Console.WriteLine(result.GetProperty("signatureAlgorithm").ToString()); - Console.WriteLine(result.GetProperty("treeAlgorithm").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetParameters_GetParameters_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = client.GetParameters(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetParameters_GetParameters_Convenience_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = await client.GetParametersAsync(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetDidConfig_GetDidConfig() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = client.GetDidConfig(null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("controller").ToString()); - Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("publicKeyJwk").GetProperty("kty").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetDidConfig_GetDidConfig_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = await client.GetDidConfigAsync(null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("controller").ToString()); - Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("assertionMethod")[0].GetProperty("publicKeyJwk").GetProperty("kty").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetDidConfig_GetDidConfig_Convenience() + public void Example_CodeTransparency_GetEntry_GetEntry_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = client.GetDidConfig(); + Response response = client.GetEntry("2.131"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetDidConfig_GetDidConfig_Convenience_Async() + public async Task Example_CodeTransparency_GetEntry_GetEntry_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = await client.GetDidConfigAsync(); + Response response = await client.GetEntryAsync("2.131"); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetCodeTransparencyConfig_GetCodeTransparencyConfig() + public void Example_CodeTransparency_GetEntryStatement_GetEntryStatement() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = client.GetCodeTransparencyConfig(null); + Response response = client.GetEntryStatement("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -349,13 +231,13 @@ public void Example_CodeTransparency_GetCodeTransparencyConfig_GetCodeTransparen [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetCodeTransparencyConfig_GetCodeTransparencyConfig_Async() + public async Task Example_CodeTransparency_GetEntryStatement_GetEntryStatement_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - Response response = await client.GetCodeTransparencyConfigAsync(null); + Response response = await client.GetEntryStatementAsync("2.131", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -363,130 +245,24 @@ public async Task Example_CodeTransparency_GetCodeTransparencyConfig_GetCodeTran [Test] [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetCodeTransparencyConfig_GetCodeTransparencyConfig_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = client.GetCodeTransparencyConfig(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetCodeTransparencyConfig_GetCodeTransparencyConfig_Convenience_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = await client.GetCodeTransparencyConfigAsync(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetCodeTransparencyVersion_GetCodeTransparencyVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = client.GetCodeTransparencyVersion(null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("scitt_version").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetCodeTransparencyVersion_GetCodeTransparencyVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = await client.GetCodeTransparencyVersionAsync(null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("scitt_version").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetCodeTransparencyVersion_GetCodeTransparencyVersion_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = client.GetCodeTransparencyVersion(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetCodeTransparencyVersion_GetCodeTransparencyVersion_Convenience_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - Response response = await client.GetCodeTransparencyVersionAsync(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetEntryIds_ListEntryIds() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - foreach (BinaryData item in client.GetEntryIds(null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetEntryIds_ListEntryIds_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - - await foreach (BinaryData item in client.GetEntryIdsAsync(null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CodeTransparency_GetEntryIds_ListEntryIds_Convenience() + public void Example_CodeTransparency_GetEntryStatement_GetEntryStatement_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - foreach (string item in client.GetEntryIds()) - { - } + Response response = client.GetEntryStatement("2.131"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CodeTransparency_GetEntryIds_ListEntryIds_Convenience_Async() + public async Task Example_CodeTransparency_GetEntryStatement_GetEntryStatement_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); CodeTransparencyClient client = new CodeTransparencyClient(endpoint, credential); - await foreach (string item in client.GetEntryIdsAsync()) - { - } + Response response = await client.GetEntryStatementAsync("2.131"); } } } diff --git a/sdk/confidentialledger/Azure.Security.CodeTransparency/tsp-location.yaml b/sdk/confidentialledger/Azure.Security.CodeTransparency/tsp-location.yaml index e2de52411628..da414c51743b 100644 --- a/sdk/confidentialledger/Azure.Security.CodeTransparency/tsp-location.yaml +++ b/sdk/confidentialledger/Azure.Security.CodeTransparency/tsp-location.yaml @@ -1,5 +1,4 @@ -commit: 7e22a66617633d162735fe65388c2852127b4aac -repo: Azure/azure-rest-api-specs directory: specification/confidentialledger/Microsoft.CodeTransparency -additionalDirectories: [] - +commit: fdf4f17307d2b94c92d7494a6a58919cfbac74a6 +repo: Azure/azure-rest-api-specs +additionalDirectories: