Skip to content
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
35 changes: 35 additions & 0 deletions packages/@azure/arm-apimanagement/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#git
.git
.gitignore
#gulp
gulpfile.js
#documentation
doc/
docs/
#dependencies
node_modules/
#samples
sample/
samples/
#tests
test/
tests/
coverage/
#tools and scripts
tools/
scripts/
#IDE settings
*.sln
.vscode/
.idea
.editorconfig
.ntvs_analysis.*
#build tools
.travis.yml
.jenkins.yml
.codeclimate.yml
appveyor.yml
# Nuget packages #
.nuget/
packages/
packages.config
21 changes: 21 additions & 0 deletions packages/@azure/arm-apimanagement/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2018 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
73 changes: 73 additions & 0 deletions packages/@azure/arm-apimanagement/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Azure ApiManagementClient SDK for JavaScript
This package contains an isomorphic SDK for ApiManagementClient.

## Currently supported environments
- Node.js version 6.x.x or higher
- Browser JavaScript

## How to Install
```
npm install @azure/arm-apimanagement
```


## How to use

### nodejs - Authentication, client creation and listByService policy as an example written in TypeScript.

```ts
import * as msRest from "ms-rest-js";
import * as msRestAzure from "ms-rest-azure-js";
import * as msRestNodeAuth from "ms-rest-nodeauth";
import { ApiManagementClient, ApiManagementModels, ApiManagementMappers } from "@azure/arm-apimanagement";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new ApiManagementClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const serviceName = "testserviceName";
const scope = "Tenant";
client.policy.listByService(resourceGroupName, serviceName, scope).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
```

### browser - Authentication, client creation and listByService policy as an example written in JavaScript.

- index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/arm-apimanagement sample</title>
<script src="node_modules/ms-rest-js/master/msRestBundle.js"></script>
<script src="node_modules/ms-rest-azure-js/master/msRestAzureBundle.js"></script>
<script src="node_modules/@azure/arm-apimanagement/apiManagementClientBundle.js"></script>
<script>
const subscriptionId = "<Subscription_Id>";
const token = "<access_token>";
const creds = new msRest.TokenCredentials(token);
const client = new ApiManagementClient(creds, undefined, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const serviceName = "testserviceName";
const scope = "Tenant";
client.policy.listByService(resourceGroupName, serviceName, scope).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error ocurred:');
console.error(err);
});
</script>
</head>
<body>
</body>
</html>
```

# Related projects
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
159 changes: 159 additions & 0 deletions packages/@azure/arm-apimanagement/lib/apiManagementClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/*
* 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.
*/

import * as msRest from "ms-rest-js";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
import { ApiManagementClientContext } from "./apiManagementClientContext";


class ApiManagementClient extends ApiManagementClientContext {
// Operation groups
policy: operations.Policy;
policySnippets: operations.PolicySnippets;
regions: operations.Regions;
api: operations.Api;
apiRevisions: operations.ApiRevisions;
apiRelease: operations.ApiRelease;
apiOperation: operations.ApiOperation;
apiOperationPolicy: operations.ApiOperationPolicy;
apiProduct: operations.ApiProduct;
apiPolicy: operations.ApiPolicy;
apiSchema: operations.ApiSchema;
apiDiagnostic: operations.ApiDiagnostic;
apiDiagnosticLogger: operations.ApiDiagnosticLogger;
apiIssue: operations.ApiIssue;
apiIssueComment: operations.ApiIssueComment;
apiIssueAttachment: operations.ApiIssueAttachment;
authorizationServer: operations.AuthorizationServer;
backend: operations.Backend;
certificate: operations.Certificate;
apiManagementOperations: operations.ApiManagementOperations;
apiManagementService: operations.ApiManagementService;
diagnostic: operations.Diagnostic;
diagnosticLogger: operations.DiagnosticLogger;
emailTemplate: operations.EmailTemplate;
group: operations.Group;
groupUser: operations.GroupUser;
identityProvider: operations.IdentityProvider;
logger: operations.Logger;
notification: operations.Notification;
notificationRecipientUser: operations.NotificationRecipientUser;
notificationRecipientEmail: operations.NotificationRecipientEmail;
networkStatus: operations.NetworkStatus;
openIdConnectProvider: operations.OpenIdConnectProvider;
signInSettings: operations.SignInSettings;
signUpSettings: operations.SignUpSettings;
delegationSettings: operations.DelegationSettings;
product: operations.Product;
productApi: operations.ProductApi;
productGroup: operations.ProductGroup;
productSubscriptions: operations.ProductSubscriptions;
productPolicy: operations.ProductPolicy;
property: operations.Property;
quotaByCounterKeys: operations.QuotaByCounterKeys;
quotaByPeriodKeys: operations.QuotaByPeriodKeys;
reports: operations.Reports;
subscription: operations.Subscription;
tagResource: operations.TagResource;
tag: operations.Tag;
tagDescription: operations.TagDescription;
operation: operations.OperationOperations;
tenantAccess: operations.TenantAccess;
tenantAccessGit: operations.TenantAccessGit;
tenantConfiguration: operations.TenantConfiguration;
user: operations.User;
userGroup: operations.UserGroup;
userSubscription: operations.UserSubscription;
userIdentities: operations.UserIdentities;
apiVersionSet: operations.ApiVersionSet;
apiExport: operations.ApiExport;

/**
* Initializes a new instance of the ApiManagementClient class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ApiManagementClientOptions) {
super(credentials, subscriptionId, options);
this.policy = new operations.Policy(this);
this.policySnippets = new operations.PolicySnippets(this);
this.regions = new operations.Regions(this);
this.api = new operations.Api(this);
this.apiRevisions = new operations.ApiRevisions(this);
this.apiRelease = new operations.ApiRelease(this);
this.apiOperation = new operations.ApiOperation(this);
this.apiOperationPolicy = new operations.ApiOperationPolicy(this);
this.apiProduct = new operations.ApiProduct(this);
this.apiPolicy = new operations.ApiPolicy(this);
this.apiSchema = new operations.ApiSchema(this);
this.apiDiagnostic = new operations.ApiDiagnostic(this);
this.apiDiagnosticLogger = new operations.ApiDiagnosticLogger(this);
this.apiIssue = new operations.ApiIssue(this);
this.apiIssueComment = new operations.ApiIssueComment(this);
this.apiIssueAttachment = new operations.ApiIssueAttachment(this);
this.authorizationServer = new operations.AuthorizationServer(this);
this.backend = new operations.Backend(this);
this.certificate = new operations.Certificate(this);
this.apiManagementOperations = new operations.ApiManagementOperations(this);
this.apiManagementService = new operations.ApiManagementService(this);
this.diagnostic = new operations.Diagnostic(this);
this.diagnosticLogger = new operations.DiagnosticLogger(this);
this.emailTemplate = new operations.EmailTemplate(this);
this.group = new operations.Group(this);
this.groupUser = new operations.GroupUser(this);
this.identityProvider = new operations.IdentityProvider(this);
this.logger = new operations.Logger(this);
this.notification = new operations.Notification(this);
this.notificationRecipientUser = new operations.NotificationRecipientUser(this);
this.notificationRecipientEmail = new operations.NotificationRecipientEmail(this);
this.networkStatus = new operations.NetworkStatus(this);
this.openIdConnectProvider = new operations.OpenIdConnectProvider(this);
this.signInSettings = new operations.SignInSettings(this);
this.signUpSettings = new operations.SignUpSettings(this);
this.delegationSettings = new operations.DelegationSettings(this);
this.product = new operations.Product(this);
this.productApi = new operations.ProductApi(this);
this.productGroup = new operations.ProductGroup(this);
this.productSubscriptions = new operations.ProductSubscriptions(this);
this.productPolicy = new operations.ProductPolicy(this);
this.property = new operations.Property(this);
this.quotaByCounterKeys = new operations.QuotaByCounterKeys(this);
this.quotaByPeriodKeys = new operations.QuotaByPeriodKeys(this);
this.reports = new operations.Reports(this);
this.subscription = new operations.Subscription(this);
this.tagResource = new operations.TagResource(this);
this.tag = new operations.Tag(this);
this.tagDescription = new operations.TagDescription(this);
this.operation = new operations.OperationOperations(this);
this.tenantAccess = new operations.TenantAccess(this);
this.tenantAccessGit = new operations.TenantAccessGit(this);
this.tenantConfiguration = new operations.TenantConfiguration(this);
this.user = new operations.User(this);
this.userGroup = new operations.UserGroup(this);
this.userSubscription = new operations.UserSubscription(this);
this.userIdentities = new operations.UserIdentities(this);
this.apiVersionSet = new operations.ApiVersionSet(this);
this.apiExport = new operations.ApiExport(this);
}
}

// Operation Specifications

export {
ApiManagementClient,
ApiManagementClientContext,
Models as ApiManagementModels,
Mappers as ApiManagementMappers
};
export * from "./operations";
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* 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.
*/

import * as Models from "./models";
import * as msRest from "ms-rest-js";
import * as msRestAzure from "ms-rest-azure-js";

const packageName = "@azure/arm-apimanagement";
const packageVersion = "1.0.0-preview";

export class ApiManagementClientContext extends msRestAzure.AzureServiceClient {

credentials: msRest.ServiceClientCredentials;

apiVersion: string;

subscriptionId: string;

acceptLanguage: string;

longRunningOperationRetryTimeout: number;

/**
* Initializes a new instance of the ApiManagementClient class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure
* subscription. The subscription ID forms part of the URI for every service call.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ApiManagementClientOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}
if (subscriptionId == undefined) {
throw new Error('\'subscriptionId\' cannot be null.');
}

if (!options) {
options = {};
}
super(credentials, options);

this.apiVersion = '2018-01-01';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";
this.requestContentType = "application/json; charset=utf-8";
this.credentials = credentials;
this.subscriptionId = subscriptionId;

this.addUserAgentInfo(`${packageName}/${packageVersion}`);
if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}
if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
}
}
}
Loading