Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Search: Regenerate management SDK to add service identity #5332

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// <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.Search.Models
{
using Newtonsoft.Json;
using System.Linq;

/// <summary>
/// Identity for the resource.
/// </summary>
public partial class Identity
{
/// <summary>
/// Initializes a new instance of the Identity class.
/// </summary>
public Identity()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the Identity class.
/// </summary>
/// <param name="type">The identity type. Possible values include:
/// 'None', 'SystemAssigned'</param>
/// <param name="principalId">The principal ID of resource
/// identity.</param>
/// <param name="tenantId">The tenant ID of resource.</param>
public Identity(IdentityType type, string principalId = default(string), string tenantId = default(string))
{
PrincipalId = principalId;
TenantId = tenantId;
Type = type;
CustomInit();
}

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

/// <summary>
/// Gets the principal ID of resource identity.
/// </summary>
[JsonProperty(PropertyName = "principalId")]
public string PrincipalId { get; private set; }

/// <summary>
/// Gets the tenant ID of resource.
/// </summary>
[JsonProperty(PropertyName = "tenantId")]
public string TenantId { get; private set; }

/// <summary>
/// Gets or sets the identity type. Possible values include: 'None',
/// 'SystemAssigned'
/// </summary>
[JsonProperty(PropertyName = "type")]
public IdentityType Type { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// <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.Search.Models
{
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime;
using System.Runtime.Serialization;

/// <summary>
/// Defines values for IdentityType.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum IdentityType
{
[EnumMember(Value = "None")]
None,
[EnumMember(Value = "SystemAssigned")]
SystemAssigned
}
internal static class IdentityTypeEnumExtension
{
internal static string ToSerializedValue(this IdentityType? value)
{
return value == null ? null : ((IdentityType)value).ToSerializedValue();
}

internal static string ToSerializedValue(this IdentityType value)
{
switch( value )
{
case IdentityType.None:
return "None";
case IdentityType.SystemAssigned:
return "SystemAssigned";
}
return null;
}

internal static IdentityType? ParseIdentityType(this string value)
{
switch( value )
{
case "None":
return IdentityType.None;
case "SystemAssigned":
return IdentityType.SystemAssigned;
}
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ public Resource()
/// property is required when creating a new resource.</param>
/// <param name="tags">Tags to help categorize the resource in the
/// Azure portal.</param>
public Resource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>))
/// <param name="identity">The identity of the resource.</param>
public Resource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), Identity identity = default(Identity))
{
Id = id;
Name = name;
Type = type;
Location = location;
Tags = tags;
Identity = identity;
CustomInit();
}

Expand Down Expand Up @@ -93,5 +95,24 @@ public Resource()
[JsonProperty(PropertyName = "tags")]
public IDictionary<string, string> Tags { get; set; }

/// <summary>
/// Gets or sets the identity of the resource.
/// </summary>
[JsonProperty(PropertyName = "identity")]
public Identity Identity { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Identity != null)
{
Identity.Validate();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public SearchService()
/// property is required when creating a new resource.</param>
/// <param name="tags">Tags to help categorize the resource in the
/// Azure portal.</param>
/// <param name="identity">The identity of the resource.</param>
/// <param name="replicaCount">The number of replicas in the Search
/// service. If specified, it must be a value between 1 and 12
/// inclusive for standard SKUs or between 1 and 3 inclusive for basic
Expand Down Expand Up @@ -93,8 +94,8 @@ public SearchService()
/// <param name="sku">The SKU of the Search Service, which determines
/// price tier and capacity limits. This property is required when
/// creating a new Search Service.</param>
public SearchService(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), int? replicaCount = default(int?), int? partitionCount = default(int?), HostingMode? hostingMode = default(HostingMode?), SearchServiceStatus? status = default(SearchServiceStatus?), string statusDetails = default(string), ProvisioningState? provisioningState = default(ProvisioningState?), Sku sku = default(Sku))
: base(id, name, type, location, tags)
public SearchService(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), Identity identity = default(Identity), int? replicaCount = default(int?), int? partitionCount = default(int?), HostingMode? hostingMode = default(HostingMode?), SearchServiceStatus? status = default(SearchServiceStatus?), string statusDetails = default(string), ProvisioningState? provisioningState = default(ProvisioningState?), Sku sku = default(Sku))
: base(id, name, type, location, tags, identity)
{
ReplicaCount = replicaCount;
PartitionCount = partitionCount;
Expand Down Expand Up @@ -198,8 +199,9 @@ public SearchService()
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
public override void Validate()
{
base.Validate();
if (ReplicaCount > 12)
{
throw new ValidationException(ValidationRules.InclusiveMaximum, "ReplicaCount", 12);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@

using System;
using System.Collections.Generic;
using System.Linq;
// <auto-generated>
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>

internal static partial class SdkInfo
namespace Microsoft.Azure.Management.Search
{
public static IEnumerable<Tuple<string, string, string>> ApiInfo_SearchManagementClient
{
get
{
return new Tuple<string, string, string>[]
{
using System;
using System.Collections.Generic;
using System.Linq;

internal static partial class SdkInfo
{
public static IEnumerable<Tuple<string, string, string>> ApiInfo_SearchManagementClient
{
get
{
return new Tuple<string, string, string>[]
{
new Tuple<string, string, string>("Search", "AdminKeys", "2015-08-19"),
new Tuple<string, string, string>("Search", "Operations", "2015-08-19"),
new Tuple<string, string, string>("Search", "QueryKeys", "2015-08-19"),
new Tuple<string, string, string>("Search", "Services", "2015-08-19"),
}.AsEnumerable();
}
}
}.AsEnumerable();
}
}
// BEGIN: Code Generation Metadata Section
public static readonly String AutoRestVersion = "latest";
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/search/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\Repos\\azure-sdk-for-net\\src\\SDKs";
public static readonly String GithubForkName = "Azure";
public static readonly String GithubBranchName = "master";
public static readonly String GithubCommidId = "6a18208aed692f02215a2ea50736c0a8d5ac7329";
public static readonly String CodeGenerationErrors = "";
public static readonly String GithubRepoName = "azure-rest-api-specs";
// END: Code Generation Metadata Section
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Description>Makes it easy to manage Azure Search services and API keys from a .NET application.</Description>
<AssemblyTitle>Microsoft Azure Search Management Library</AssemblyTitle>
<AssemblyName>Microsoft.Azure.Management.Search</AssemblyName>
<Version>2.0.1</Version>
<Version>3.0.0</Version>
<PackageTags>Microsoft Azure Search;Microsoft Azure Search Management;</PackageTags>
<PackageReleaseNotes>This is the Azure Search Management SDK for .NET, based on version 2015-08-19 of the Azure Search Management REST API. It includes support for programmatically provisioning and managing Search services and API keys. It supports all available SKUs, including the new S3 and S3 High-Density SKUs. Taking dependency on 10.0.3 version of Newtonsoft nuget package.</PackageReleaseNotes>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
[assembly: AssemblyTitle("Microsoft Azure Search Management Library")]
[assembly: AssemblyDescription("Makes it easy to manage Azure Search services from a .NET application.")]

[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
Expand Down
34 changes: 33 additions & 1 deletion src/SDKs/Search/Management/Management.Search/generate.ps1
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
Start-AutoRestCodeGeneration -ResourceProvider "search/resource-manager" -AutoRestVersion "latest"
# ----------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ----------------------------------------------------------------------------------

<#

.SYNOPSIS
Powershell script that generates the C# SDK code for Management.Search from a Swagger spec

.DESCRIPTION
This script:
- fetches the config file from user/branch provided
- Generates code based off the config file provided

.PARAMETER SpecsRepoFork
The Rest Spec repo fork which contains the config file; the default is Azure.

.PARAMETER SpecsRepoBranch
The Branch which contains the config file; the default is master.

#>

Param(
[string] $SpecsRepoFork = "Azure",
[string] $SpecsRepoBranch = "master"
)

$repoRoot = "$PSScriptRoot\..\..\..\..\.."
$generateFolder = "$PSScriptRoot\Generated"

Start-AutoRestCodeGeneration -ResourceProvider "search/resource-manager" -AutoRestVersion "latest" -SpecsRepoFork $SpecsRepoFork -SpecsRepoBranch $SpecsRepoBranch
natinimni marked this conversation as resolved.
Show resolved Hide resolved
Loading