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

[ReleasePR @azure/arm-communication] [Communication] Init Configuration for Azure CLI #12301

Closed
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
9 changes: 4 additions & 5 deletions sdk/communication/arm-communication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install @azure/arm-communication

### How to use

#### nodejs - Authentication, client creation and list operations as an example written in TypeScript.
#### nodejs - client creation and list operations as an example written in TypeScript.

##### Install @azure/ms-rest-nodeauth

Expand All @@ -26,11 +26,10 @@ npm install @azure/ms-rest-nodeauth@"^3.0.0"

##### Sample code

While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
```typescript
import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { CommunicationServiceManagementClient, CommunicationServiceManagementModels, CommunicationServiceManagementMappers } from "@azure/arm-communication";
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
Expand Down
4 changes: 2 additions & 2 deletions sdk/communication/arm-communication/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const config = {
"@azure/ms-rest-azure-js": "msRestAzure"
},
banner: `/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand All @@ -16,6 +16,8 @@ export {
ErrorResponseError,
LinkedNotificationHub,
LinkNotificationHubParameters,
NameAvailability,
NameAvailabilityParameters,
RegenerateKeyParameters,
TaggedResource
} from "../models/mappers";
69 changes: 66 additions & 3 deletions sdk/communication/arm-communication/src/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand Down Expand Up @@ -168,6 +168,39 @@ export interface Operation {
properties?: OperationProperties;
}

/**
* Data POST-ed to the nameAvailability action
*/
export interface NameAvailabilityParameters {
/**
* The resource type. Should be always "Microsoft.Communication/CommunicationServices".
*/
type: string;
/**
* The CommunicationService name to validate. e.g."my-CommunicationService-name-here"
*/
name: string;
}

/**
* Result of the request to check name availability. It contains a flag and possible reason of
* failure.
*/
export interface NameAvailability {
/**
* Indicates whether the name is available or not.
*/
nameAvailable?: boolean;
/**
* The reason of the availability. Required if name is not available.
*/
reason?: string;
/**
* The message of the operation.
*/
message?: string;
}

/**
* Description of an Azure Notification Hub to link to the communication service
*/
Expand Down Expand Up @@ -197,7 +230,7 @@ export interface LinkedNotificationHub {
*/
export interface OperationStatus {
/**
* The operation Id.
* Fully qualified ID for the operation status.
* **NOTE: This property will not be serialized. It can only be populated by the server.**
*/
readonly id?: string;
Expand Down Expand Up @@ -362,6 +395,16 @@ export interface RegenerateKeyParameters {
keyType?: KeyType;
}

/**
* Optional Parameters.
*/
export interface CommunicationServiceCheckNameAvailabilityOptionalParams extends msRest.RequestOptionsBase {
/**
* Parameters supplied to the operation.
*/
nameAvailabilityParameters?: NameAvailabilityParameters;
}

/**
* Optional Parameters.
*/
Expand Down Expand Up @@ -538,6 +581,26 @@ export type OperationsListNextResponse = OperationList & {
};
};

/**
* Contains response data for the checkNameAvailability operation.
*/
export type CommunicationServiceCheckNameAvailabilityResponse = NameAvailability & {
/**
* The underlying HTTP response.
*/
_response: msRest.HttpResponse & {
/**
* The response body as text (string format)
*/
bodyAsText: string;

/**
* The response body as parsed JSON or XML
*/
parsedBody: NameAvailability;
};
};

/**
* Contains response data for the linkNotificationHub operation.
*/
Expand Down
56 changes: 54 additions & 2 deletions sdk/communication/arm-communication/src/models/mappers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand Down Expand Up @@ -258,6 +258,58 @@ export const Operation: msRest.CompositeMapper = {
}
};

export const NameAvailabilityParameters: msRest.CompositeMapper = {
serializedName: "NameAvailabilityParameters",
type: {
name: "Composite",
className: "NameAvailabilityParameters",
modelProperties: {
type: {
required: true,
serializedName: "type",
type: {
name: "String"
}
},
name: {
required: true,
serializedName: "name",
type: {
name: "String"
}
}
}
}
};

export const NameAvailability: msRest.CompositeMapper = {
serializedName: "NameAvailability",
type: {
name: "Composite",
className: "NameAvailability",
modelProperties: {
nameAvailable: {
serializedName: "nameAvailable",
type: {
name: "Boolean"
}
},
reason: {
serializedName: "reason",
type: {
name: "String"
}
},
message: {
serializedName: "message",
type: {
name: "String"
}
}
}
}
};

export const LinkNotificationHubParameters: msRest.CompositeMapper = {
serializedName: "LinkNotificationHubParameters",
type: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand Down
5 changes: 2 additions & 3 deletions sdk/communication/arm-communication/src/models/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand All @@ -27,6 +26,31 @@ export class CommunicationService {
this.client = client;
}

/**
* Checks that the CommunicationService name is valid and is not already in use.
* @summary Check Name Availability
* @param [options] The optional parameters
* @returns Promise<Models.CommunicationServiceCheckNameAvailabilityResponse>
*/
checkNameAvailability(options?: Models.CommunicationServiceCheckNameAvailabilityOptionalParams): Promise<Models.CommunicationServiceCheckNameAvailabilityResponse>;
/**
* @param callback The callback
*/
checkNameAvailability(callback: msRest.ServiceCallback<Models.NameAvailability>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
checkNameAvailability(options: Models.CommunicationServiceCheckNameAvailabilityOptionalParams, callback: msRest.ServiceCallback<Models.NameAvailability>): void;
checkNameAvailability(options?: Models.CommunicationServiceCheckNameAvailabilityOptionalParams | msRest.ServiceCallback<Models.NameAvailability>, callback?: msRest.ServiceCallback<Models.NameAvailability>): Promise<Models.CommunicationServiceCheckNameAvailabilityResponse> {
return this.client.sendOperationRequest(
{
options
},
checkNameAvailabilityOperationSpec,
callback) as Promise<Models.CommunicationServiceCheckNameAvailabilityResponse>;
}

/**
* Links an Azure Notification Hub to this communication service.
* @summary Link Notification Hub
Expand Down Expand Up @@ -394,6 +418,36 @@ export class CommunicationService {

// Operation Specifications
const serializer = new msRest.Serializer(Mappers);
const checkNameAvailabilityOperationSpec: msRest.OperationSpec = {
httpMethod: "POST",
path: "subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability",
urlParameters: [
Parameters.subscriptionId
],
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
requestBody: {
parameterPath: [
"options",
"nameAvailabilityParameters"
],
mapper: Mappers.NameAvailabilityParameters
},
responses: {
200: {
bodyMapper: Mappers.NameAvailability
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};

const linkNotificationHubOperationSpec: msRest.OperationSpec = {
httpMethod: "POST",
path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/linkNotificationHub",
Expand Down Expand Up @@ -667,6 +721,9 @@ const listBySubscriptionNextOperationSpec: msRest.OperationSpec = {
urlParameters: [
Parameters.nextPageLink
],
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
Expand All @@ -688,6 +745,9 @@ const listByResourceGroupNextOperationSpec: msRest.OperationSpec = {
urlParameters: [
Parameters.nextPageLink
],
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
Expand Down
5 changes: 2 additions & 3 deletions sdk/communication/arm-communication/src/operations/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand Down
Loading