Skip to content

Commit

Permalink
Updated management SDK for Azure Attestation Service to latest swagge…
Browse files Browse the repository at this point in the history
…r spec with Location and Tags support (#10212)

* Updated to latest swagger spec with Location and Tags support

* Fixed mix up in version number

* Delete code-model-v1

Co-authored-by: Yeming Liu <felix_liu@outlook.com>
  • Loading branch information
gkostal and isra-fel authored Mar 2, 2020
1 parent 92ddcba commit 1804aac
Show file tree
Hide file tree
Showing 15 changed files with 638 additions and 116 deletions.
8 changes: 4 additions & 4 deletions eng/mgmt/mgmtmetadata/attestation_resource-manager.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ AutoRest installed successfully.
Commencing code generation
Generating CSharp code
Executing AutoRest command
cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/attestation/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\azure-sdk-for-net\sdk
2019-11-20 19:18:25 UTC
cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/attestation/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\github\gkostal\azure-sdk-for-net\sdk
2020-02-28 13:33:27 UTC
Azure-rest-api-specs repository information
GitHub fork: Azure
Branch: master
Commit: 65862acc6ca8d117bff3258d409d8a9d8244f773
Commit: 719827a2f6560db22a873828100b8aff1317c483
AutoRest information
Requested version: latest
Bootstrapper version: autorest@2.0.4407
Bootstrapper version: autorest@2.0.4413

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static AttestationProvider Get(this IAttestationProvidersOperations opera
/// <param name='creationParams'>
/// Client supplied parameters.
/// </param>
public static AttestationProvider Create(this IAttestationProvidersOperations operations, string resourceGroupName, string providerName, AttestationServiceCreationParams creationParams = default(AttestationServiceCreationParams))
public static AttestationProvider Create(this IAttestationProvidersOperations operations, string resourceGroupName, string providerName, AttestationServiceCreationParams creationParams)
{
return operations.CreateAsync(resourceGroupName, providerName, creationParams).GetAwaiter().GetResult();
}
Expand All @@ -99,14 +99,60 @@ public static AttestationProvider Get(this IAttestationProvidersOperations opera
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<AttestationProvider> CreateAsync(this IAttestationProvidersOperations operations, string resourceGroupName, string providerName, AttestationServiceCreationParams creationParams = default(AttestationServiceCreationParams), CancellationToken cancellationToken = default(CancellationToken))
public static async Task<AttestationProvider> CreateAsync(this IAttestationProvidersOperations operations, string resourceGroupName, string providerName, AttestationServiceCreationParams creationParams, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, providerName, creationParams, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// Updates the Attestation Provider.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group. The name is case insensitive.
/// </param>
/// <param name='providerName'>
/// Name of the attestation service
/// </param>
/// <param name='updateParams'>
/// Client supplied parameters.
/// </param>
public static AttestationProvider Update(this IAttestationProvidersOperations operations, string resourceGroupName, string providerName, AttestationServicePatchParams updateParams)
{
return operations.UpdateAsync(resourceGroupName, providerName, updateParams).GetAwaiter().GetResult();
}

/// <summary>
/// Updates the Attestation Provider.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group. The name is case insensitive.
/// </param>
/// <param name='providerName'>
/// Name of the attestation service
/// </param>
/// <param name='updateParams'>
/// Client supplied parameters.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<AttestationProvider> UpdateAsync(this IAttestationProvidersOperations operations, string resourceGroupName, string providerName, AttestationServicePatchParams updateParams, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, providerName, updateParams, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// Delete Attestation Service.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,35 @@ public partial interface IAttestationProvidersOperations
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<AttestationProvider>> CreateWithHttpMessagesAsync(string resourceGroupName, string providerName, AttestationServiceCreationParams creationParams = default(AttestationServiceCreationParams), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse<AttestationProvider>> CreateWithHttpMessagesAsync(string resourceGroupName, string providerName, AttestationServiceCreationParams creationParams, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Updates the Attestation Provider.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group. The name is case insensitive.
/// </param>
/// <param name='providerName'>
/// Name of the attestation service
/// </param>
/// <param name='updateParams'>
/// Client supplied parameters.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<AttestationProvider>> UpdateWithHttpMessagesAsync(string resourceGroupName, string providerName, AttestationServicePatchParams updateParams, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Delete Attestation Service.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ namespace Microsoft.Azure.Management.Attestation.Models
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

/// <summary>
/// Attestation service response message.
/// </summary>
[Rest.Serialization.JsonTransformation]
public partial class AttestationProvider : Resource
public partial class AttestationProvider : TrackedResource
{
/// <summary>
/// Initializes a new instance of the AttestationProvider class.
Expand All @@ -32,6 +34,8 @@ public AttestationProvider()
/// <summary>
/// Initializes a new instance of the AttestationProvider class.
/// </summary>
/// <param name="location">The geo-location where the resource
/// lives</param>
/// <param name="status">Status of attestation service. Possible values
/// include: 'Ready', 'NotReady', 'Error'</param>
/// <param name="id">Fully qualified resource Id for the resource. Ex -
Expand All @@ -40,10 +44,14 @@ public AttestationProvider()
/// <param name="type">The type of the resource. Ex-
/// Microsoft.Compute/virtualMachines or
/// Microsoft.Storage/storageAccounts.</param>
/// <param name="tags">Resource tags.</param>
/// <param name="trustModel">Trust model for the attestation service
/// instance.</param>
/// <param name="attestUri">Gets the uri of attestation service</param>
public AttestationProvider(string status, string id = default(string), string name = default(string), string type = default(string), string attestUri = default(string))
: base(id, name, type)
public AttestationProvider(string location, string status, string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), string trustModel = default(string), string attestUri = default(string))
: base(location, id, name, type, tags)
{
TrustModel = trustModel;
Status = status;
AttestUri = attestUri;
CustomInit();
Expand All @@ -54,6 +62,12 @@ public AttestationProvider()
/// </summary>
partial void CustomInit();

/// <summary>
/// Gets or sets trust model for the attestation service instance.
/// </summary>
[JsonProperty(PropertyName = "properties.trustModel")]
public string TrustModel { get; set; }

/// <summary>
/// Gets or sets status of attestation service. Possible values
/// include: 'Ready', 'NotReady', 'Error'
Expand All @@ -73,8 +87,9 @@ public AttestationProvider()
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
public override void Validate()
{
base.Validate();
if (Status == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Status");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@

namespace Microsoft.Azure.Management.Attestation.Models
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

/// <summary>
/// Client supplied parameters passed to attestation service.
/// Parameters for creating an attestation service instance
/// </summary>
public partial class AttestationServiceCreationParams
public partial class AttestationServiceCreationParams : IResource
{
/// <summary>
/// Initializes a new instance of the AttestationServiceCreationParams
Expand All @@ -31,15 +35,17 @@ public AttestationServiceCreationParams()
/// Initializes a new instance of the AttestationServiceCreationParams
/// class.
/// </summary>
/// <param name="attestationPolicy">Name of attestation policy.</param>
/// <param name="policySigningCertificates">JSON Web Key Set defining a
/// set of X.509 Certificates that will represent the parent
/// certificate for the signing certificate used for policy
/// operations</param>
public AttestationServiceCreationParams(string attestationPolicy = default(string), JSONWebKeySet policySigningCertificates = default(JSONWebKeySet))
/// <param name="location">The supported Azure location where the
/// attestation service instance should be created.</param>
/// <param name="properties">Properties of the attestation service
/// instance</param>
/// <param name="tags">The tags that will be assigned to the
/// attestation service instance.</param>
public AttestationServiceCreationParams(string location, AttestationServiceCreationSpecificParams properties, IDictionary<string, string> tags = default(IDictionary<string, string>))
{
AttestationPolicy = attestationPolicy;
PolicySigningCertificates = policySigningCertificates;
Location = location;
Tags = tags;
Properties = properties;
CustomInit();
}

Expand All @@ -49,18 +55,41 @@ public AttestationServiceCreationParams()
partial void CustomInit();

/// <summary>
/// Gets or sets name of attestation policy.
/// Gets or sets the supported Azure location where the attestation
/// service instance should be created.
/// </summary>
[JsonProperty(PropertyName = "attestationPolicy")]
public string AttestationPolicy { get; set; }
[JsonProperty(PropertyName = "location")]
public string Location { get; set; }

/// <summary>
/// Gets or sets JSON Web Key Set defining a set of X.509 Certificates
/// that will represent the parent certificate for the signing
/// certificate used for policy operations
/// Gets or sets the tags that will be assigned to the attestation
/// service instance.
/// </summary>
[JsonProperty(PropertyName = "policySigningCertificates")]
public JSONWebKeySet PolicySigningCertificates { get; set; }
[JsonProperty(PropertyName = "tags")]
public IDictionary<string, string> Tags { get; set; }

/// <summary>
/// Gets or sets properties of the attestation service instance
/// </summary>
[JsonProperty(PropertyName = "properties")]
public AttestationServiceCreationSpecificParams Properties { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Location == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Location");
}
if (Properties == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Properties");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>

namespace Microsoft.Azure.Management.Attestation.Models
{
using Newtonsoft.Json;
using System.Linq;

/// <summary>
/// Client supplied parameters used to create a new attestation service
/// instance.
/// </summary>
public partial class AttestationServiceCreationSpecificParams
{
/// <summary>
/// Initializes a new instance of the
/// AttestationServiceCreationSpecificParams class.
/// </summary>
public AttestationServiceCreationSpecificParams()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the
/// AttestationServiceCreationSpecificParams class.
/// </summary>
/// <param name="attestationPolicy">Name of attestation policy.</param>
/// <param name="policySigningCertificates">JSON Web Key Set defining a
/// set of X.509 Certificates that will represent the parent
/// certificate for the signing certificate used for policy
/// operations</param>
public AttestationServiceCreationSpecificParams(string attestationPolicy = default(string), JSONWebKeySet policySigningCertificates = default(JSONWebKeySet))
{
AttestationPolicy = attestationPolicy;
PolicySigningCertificates = policySigningCertificates;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// Gets or sets name of attestation policy.
/// </summary>
[JsonProperty(PropertyName = "attestationPolicy")]
public string AttestationPolicy { get; set; }

/// <summary>
/// Gets or sets JSON Web Key Set defining a set of X.509 Certificates
/// that will represent the parent certificate for the signing
/// certificate used for policy operations
/// </summary>
[JsonProperty(PropertyName = "policySigningCertificates")]
public JSONWebKeySet PolicySigningCertificates { get; set; }

}
}
Loading

0 comments on commit 1804aac

Please sign in to comment.