diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/IManagedServiceIdentityClient.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/IManagedServiceIdentityClient.cs index c09a0c99ccdb..7ac27d09e317 100644 --- a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/IManagedServiceIdentityClient.cs +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/IManagedServiceIdentityClient.cs @@ -69,6 +69,11 @@ public partial interface IManagedServiceIdentityClient : System.IDisposable bool? GenerateClientRequestId { get; set; } + /// + /// Gets the ISystemAssignedIdentitiesOperations. + /// + ISystemAssignedIdentitiesOperations SystemAssignedIdentities { get; } + /// /// Gets the IOperations. /// diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/ISystemAssignedIdentitiesOperations.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/ISystemAssignedIdentitiesOperations.cs new file mode 100644 index 000000000000..7e1435ff4da7 --- /dev/null +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/ISystemAssignedIdentitiesOperations.cs @@ -0,0 +1,51 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.ManagedServiceIdentity +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SystemAssignedIdentitiesOperations operations. + /// + public partial interface ISystemAssignedIdentitiesOperations + { + /// + /// Gets the systemAssignedIdentity available under the specified RP + /// scope. + /// + /// + /// The resource provider scope of the resource. Parent resource being + /// extended by Managed Identities. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByScopeWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/IUserAssignedIdentitiesOperations.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/IUserAssignedIdentitiesOperations.cs index a05e2af3a21d..753172de93a5 100644 --- a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/IUserAssignedIdentitiesOperations.cs +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/IUserAssignedIdentitiesOperations.cs @@ -123,7 +123,7 @@ public partial interface IUserAssignedIdentitiesOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Identity parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, IdentityUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the identity. /// diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/ManagedServiceIdentityClient.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/ManagedServiceIdentityClient.cs index 3ac00601114f..7c63088cc2f2 100644 --- a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/ManagedServiceIdentityClient.cs +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/ManagedServiceIdentityClient.cs @@ -74,6 +74,11 @@ public partial class ManagedServiceIdentityClient : ServiceClient public bool? GenerateClientRequestId { get; set; } + /// + /// Gets the ISystemAssignedIdentitiesOperations. + /// + public virtual ISystemAssignedIdentitiesOperations SystemAssignedIdentities { get; private set; } + /// /// Gets the IOperations. /// @@ -325,6 +330,7 @@ public ManagedServiceIdentityClient(System.Uri baseUri, ServiceClientCredentials /// private void Initialize() { + SystemAssignedIdentities = new SystemAssignedIdentitiesOperations(this); Operations = new Operations(this); UserAssignedIdentities = new UserAssignedIdentitiesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/AzureEntityResource.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 000000000000..e79f1d4038c5 --- /dev/null +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/AzureEntityResource.cs @@ -0,0 +1,59 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.ManagedServiceIdentity.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition for a Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(id, name, type) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/Identity.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/Identity.cs index 13aef9f36ada..54300a22d15d 100644 --- a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/Identity.cs +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/Identity.cs @@ -11,7 +11,6 @@ namespace Microsoft.Azure.Management.ManagedServiceIdentity.Models { using Microsoft.Rest; - using Microsoft.Rest.Azure; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; @@ -22,7 +21,7 @@ namespace Microsoft.Azure.Management.ManagedServiceIdentity.Models /// Describes an identity resource. /// [Rest.Serialization.JsonTransformation] - public partial class Identity : IResource + public partial class Identity : TrackedResource { /// /// Initializes a new instance of the Identity class. @@ -35,35 +34,27 @@ public Identity() /// /// Initializes a new instance of the Identity class. /// - /// The id of the created identity. - /// The name of the created identity. - /// The Azure region where the identity - /// lives. - /// Resource tags + /// The geo-location where the resource + /// lives + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. /// The id of the tenant which the identity /// belongs to. /// The id of the service principal object /// associated with the created identity. /// The id of the app associated with the /// identity. This is a random generated UUID by MSI. - /// The ManagedServiceIdentity DataPlane - /// URL that can be queried to obtain the identity credentials. If - /// identity is user assigned, then the clientSecretUrl will not be - /// present in the response, otherwise it will be present. - /// The type of resource i.e. - /// Microsoft.ManagedIdentity/userAssignedIdentities. Possible values - /// include: 'Microsoft.ManagedIdentity/userAssignedIdentities' - public Identity(string id = default(string), string name = default(string), string location = default(string), IDictionary tags = default(IDictionary), System.Guid? tenantId = default(System.Guid?), System.Guid? principalId = default(System.Guid?), System.Guid? clientId = default(System.Guid?), string clientSecretUrl = default(string), string type = default(string)) + public Identity(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), System.Guid? tenantId = default(System.Guid?), System.Guid? principalId = default(System.Guid?), System.Guid? clientId = default(System.Guid?)) + : base(location, id, name, type, tags) { - Id = id; - Name = name; - Location = location; - Tags = tags; TenantId = tenantId; PrincipalId = principalId; ClientId = clientId; - ClientSecretUrl = clientSecretUrl; - Type = type; CustomInit(); } @@ -72,30 +63,6 @@ public Identity() /// partial void CustomInit(); - /// - /// Gets the id of the created identity. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets the name of the created identity. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets or sets the Azure region where the identity lives. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - /// /// Gets the id of the tenant which the identity belongs to. /// @@ -117,21 +84,14 @@ public Identity() public System.Guid? ClientId { get; private set; } /// - /// Gets The ManagedServiceIdentity DataPlane URL that can be queried - /// to obtain the identity credentials. If identity is user assigned, - /// then the clientSecretUrl will not be present in the response, - /// otherwise it will be present. + /// Validate the object. /// - [JsonProperty(PropertyName = "properties.clientSecretUrl")] - public string ClientSecretUrl { get; private set; } - - /// - /// Gets the type of resource i.e. - /// Microsoft.ManagedIdentity/userAssignedIdentities. Possible values - /// include: 'Microsoft.ManagedIdentity/userAssignedIdentities' - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } } } diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/IdentityUpdate.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/IdentityUpdate.cs new file mode 100644 index 000000000000..72d121a70532 --- /dev/null +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/IdentityUpdate.cs @@ -0,0 +1,101 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.ManagedServiceIdentity.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes an identity resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class IdentityUpdate : Resource + { + /// + /// Initializes a new instance of the IdentityUpdate class. + /// + public IdentityUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IdentityUpdate class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// The geo-location where the resource + /// lives + /// Resource tags + /// The id of the tenant which the identity + /// belongs to. + /// The id of the service principal object + /// associated with the created identity. + /// The id of the app associated with the + /// identity. This is a random generated UUID by MSI. + public IdentityUpdate(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), System.Guid? tenantId = default(System.Guid?), System.Guid? principalId = default(System.Guid?), System.Guid? clientId = default(System.Guid?)) + : base(id, name, type) + { + Location = location; + Tags = tags; + TenantId = tenantId; + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets the id of the tenant which the identity belongs to. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public System.Guid? TenantId { get; private set; } + + /// + /// Gets the id of the service principal object associated with the + /// created identity. + /// + [JsonProperty(PropertyName = "properties.principalId")] + public System.Guid? PrincipalId { get; private set; } + + /// + /// Gets the id of the app associated with the identity. This is a + /// random generated UUID by MSI. + /// + [JsonProperty(PropertyName = "properties.clientId")] + public System.Guid? ClientId { get; private set; } + + } +} diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/ProxyResource.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..7cf9fb57db92 --- /dev/null +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,50 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.ManagedServiceIdentity.Models +{ + using System.Linq; + + /// + /// The resource model definition for a ARM proxy resource. It will have + /// everything other than required location and tags + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/Resource.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..754e6c1534f8 --- /dev/null +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/Resource.cs @@ -0,0 +1,72 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.ManagedServiceIdentity.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public Resource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/SystemAssignedIdentity.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/SystemAssignedIdentity.cs new file mode 100644 index 000000000000..35159a460061 --- /dev/null +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/SystemAssignedIdentity.cs @@ -0,0 +1,124 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.ManagedServiceIdentity.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a system assigned identity resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class SystemAssignedIdentity : ProxyResource + { + /// + /// Initializes a new instance of the SystemAssignedIdentity class. + /// + public SystemAssignedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemAssignedIdentity class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags + /// The id of the tenant which the identity + /// belongs to. + /// The id of the service principal object + /// associated with the created identity. + /// The id of the app associated with the + /// identity. This is a random generated UUID by MSI. + /// The ManagedServiceIdentity DataPlane + /// URL that can be queried to obtain the identity credentials. + public SystemAssignedIdentity(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), System.Guid? tenantId = default(System.Guid?), System.Guid? principalId = default(System.Guid?), System.Guid? clientId = default(System.Guid?), string clientSecretUrl = default(string)) + : base(id, name, type) + { + Location = location; + Tags = tags; + TenantId = tenantId; + PrincipalId = principalId; + ClientId = clientId; + ClientSecretUrl = clientSecretUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets the id of the tenant which the identity belongs to. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public System.Guid? TenantId { get; private set; } + + /// + /// Gets the id of the service principal object associated with the + /// created identity. + /// + [JsonProperty(PropertyName = "properties.principalId")] + public System.Guid? PrincipalId { get; private set; } + + /// + /// Gets the id of the app associated with the identity. This is a + /// random generated UUID by MSI. + /// + [JsonProperty(PropertyName = "properties.clientId")] + public System.Guid? ClientId { get; private set; } + + /// + /// Gets The ManagedServiceIdentity DataPlane URL that can be queried + /// to obtain the identity credentials. + /// + [JsonProperty(PropertyName = "properties.clientSecretUrl")] + public string ClientSecretUrl { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/TrackedResource.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..0c6dda5ee004 --- /dev/null +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/TrackedResource.cs @@ -0,0 +1,83 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.ManagedServiceIdentity.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition for a ARM tracked top level resource + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/UserAssignedIdentities.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/UserAssignedIdentities.cs deleted file mode 100644 index 2e16c2e6a4fe..000000000000 --- a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/Models/UserAssignedIdentities.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -// 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. -// - -namespace Microsoft.Azure.Management.ManagedServiceIdentity.Models -{ - - /// - /// Defines values for UserAssignedIdentities. - /// - public static class UserAssignedIdentities - { - public const string MicrosoftManagedIdentityUserAssignedIdentities = "Microsoft.ManagedIdentity/userAssignedIdentities"; - } -} diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/SdkInfo_ManagedServiceIdentityClient.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/SdkInfo_ManagedServiceIdentityClient.cs index 995c1df962fd..41dd0fd671f5 100644 --- a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/SdkInfo_ManagedServiceIdentityClient.cs +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/SdkInfo_ManagedServiceIdentityClient.cs @@ -20,20 +20,10 @@ public static IEnumerable> ApiInfo_ManagedServiceI return new Tuple[] { new Tuple("ManagedIdentity", "Operations", "2018-11-30"), + new Tuple("ManagedIdentity", "SystemAssignedIdentities", "2018-11-30"), new Tuple("ManagedIdentity", "UserAssignedIdentities", "2018-11-30"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "2.0.4283"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/msi/resource-manager/readme.md --csharp --version=2.0.4283 --reflect-api-versions --csharp-sdks-folder=C:\\azure-sdk-for-net\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "39f45ec8b0d69bce4aeb46564a498615df7d028c"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/SystemAssignedIdentitiesOperations.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/SystemAssignedIdentitiesOperations.cs new file mode 100644 index 000000000000..43644c870874 --- /dev/null +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/SystemAssignedIdentitiesOperations.cs @@ -0,0 +1,237 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.ManagedServiceIdentity +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SystemAssignedIdentitiesOperations operations. + /// + internal partial class SystemAssignedIdentitiesOperations : IServiceOperations, ISystemAssignedIdentitiesOperations + { + /// + /// Initializes a new instance of the SystemAssignedIdentitiesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SystemAssignedIdentitiesOperations(ManagedServiceIdentityClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ManagedServiceIdentityClient + /// + public ManagedServiceIdentityClient Client { get; private set; } + + /// + /// Gets the systemAssignedIdentity available under the specified RP scope. + /// + /// + /// The resource provider scope of the resource. Parent resource being extended + /// by Managed Identities. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByScopeWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByScope", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.ManagedIdentity/identities/default").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/SystemAssignedIdentitiesOperationsExtensions.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/SystemAssignedIdentitiesOperationsExtensions.cs new file mode 100644 index 000000000000..15e7d257028e --- /dev/null +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/SystemAssignedIdentitiesOperationsExtensions.cs @@ -0,0 +1,61 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.ManagedServiceIdentity +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SystemAssignedIdentitiesOperations. + /// + public static partial class SystemAssignedIdentitiesOperationsExtensions + { + /// + /// Gets the systemAssignedIdentity available under the specified RP scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource provider scope of the resource. Parent resource being extended + /// by Managed Identities. + /// + public static SystemAssignedIdentity GetByScope(this ISystemAssignedIdentitiesOperations operations, string scope) + { + return operations.GetByScopeAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Gets the systemAssignedIdentity available under the specified RP scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource provider scope of the resource. Parent resource being extended + /// by Managed Identities. + /// + /// + /// The cancellation token. + /// + public static async Task GetByScopeAsync(this ISystemAssignedIdentitiesOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByScopeWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/UserAssignedIdentitiesOperations.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/UserAssignedIdentitiesOperations.cs index 1e4ea974e3e3..48a2b9722c4c 100644 --- a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/UserAssignedIdentitiesOperations.cs +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/UserAssignedIdentitiesOperations.cs @@ -473,6 +473,10 @@ internal UserAssignedIdentitiesOperations(ManagedServiceIdentityClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -679,7 +683,7 @@ internal UserAssignedIdentitiesOperations(ManagedServiceIdentityClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Identity parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, IdentityUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { diff --git a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/UserAssignedIdentitiesOperationsExtensions.cs b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/UserAssignedIdentitiesOperationsExtensions.cs index e037e8763d35..d60498c616a1 100644 --- a/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/UserAssignedIdentitiesOperationsExtensions.cs +++ b/sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity/src/Generated/UserAssignedIdentitiesOperationsExtensions.cs @@ -150,7 +150,7 @@ public static Identity CreateOrUpdate(this IUserAssignedIdentitiesOperations ope /// /// Parameters to update the identity /// - public static Identity Update(this IUserAssignedIdentitiesOperations operations, string resourceGroupName, string resourceName, Identity parameters) + public static Identity Update(this IUserAssignedIdentitiesOperations operations, string resourceGroupName, string resourceName, IdentityUpdate parameters) { return operations.UpdateAsync(resourceGroupName, resourceName, parameters).GetAwaiter().GetResult(); } @@ -173,7 +173,7 @@ public static Identity Update(this IUserAssignedIdentitiesOperations operations, /// /// The cancellation token. /// - public static async Task UpdateAsync(this IUserAssignedIdentitiesOperations operations, string resourceGroupName, string resourceName, Identity parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IUserAssignedIdentitiesOperations operations, string resourceGroupName, string resourceName, IdentityUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, parameters, null, cancellationToken).ConfigureAwait(false)) {