Skip to content

Commit

Permalink
Generated from 06f2e9dd15238131e690d078a3d206a6faf49ef4 (#1563)
Browse files Browse the repository at this point in the history
Add replica creation parameters to Postgres ResourceProvider for SDK
  • Loading branch information
AutorestCI authored Mar 14, 2019
1 parent 3ef7067 commit c76ef5a
Show file tree
Hide file tree
Showing 13 changed files with 428 additions and 140 deletions.
42 changes: 21 additions & 21 deletions packages/@azure/arm-postgresql/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,21 +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.
The MIT License (MIT)
Copyright (c) 2019 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.
203 changes: 100 additions & 103 deletions packages/@azure/arm-postgresql/README.md
Original file line number Diff line number Diff line change
@@ -1,103 +1,100 @@
## Azure PostgreSQLManagementClient SDK for JavaScript

This package contains an isomorphic SDK for PostgreSQLManagementClient.

### Currently supported environments

- Node.js version 6.x.x or higher
- Browser JavaScript

### How to Install

```
npm install @azure/arm-postgresql
```

### How to use

#### nodejs - Authentication, client creation and get servers as an example written in TypeScript.

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

```
npm install @azure/ms-rest-nodeauth
```

##### Sample code

```ts
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 { PostgreSQLManagementClient, PostgreSQLManagementModels, PostgreSQLManagementMappers } from "@azure/arm-postgresql";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new PostgreSQLManagementClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const serverName = "testserverName";
client.servers.get(resourceGroupName, serverName).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
```

#### browser - Authentication, client creation and get servers as an example written in JavaScript.

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

```
npm install @azure/ms-rest-browserauth
```

##### Sample code

See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.

- index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/arm-postgresql sample</title>
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/arm-postgresql/dist/arm-postgresql.js"></script>
<script type="text/javascript">
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.ArmPostgresql.PostgreSQLManagementClient(res.creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const serverName = "testserverName";
client.servers.get(resourceGroupName, serverName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
});
</script>
</head>
<body></body>
</html>
```

## Related projects

- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)


![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fpackages%2F%40azure%2Farm-postgresql%2FREADME.png)
## Azure PostgreSQLManagementClient SDK for JavaScript

This package contains an isomorphic SDK for PostgreSQLManagementClient.

### Currently supported environments

- Node.js version 6.x.x or higher
- Browser JavaScript

### How to Install

```bash
npm install @azure/arm-postgresql
```

### How to use

#### nodejs - Authentication, client creation and get servers as an example written in TypeScript.

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

```bash
npm install @azure/ms-rest-nodeauth
```

##### Sample code

```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 { PostgreSQLManagementClient, PostgreSQLManagementModels, PostgreSQLManagementMappers } from "@azure/arm-postgresql";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new PostgreSQLManagementClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const serverName = "testserverName";
client.servers.get(resourceGroupName, serverName).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
```

#### browser - Authentication, client creation and get servers as an example written in JavaScript.

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

```bash
npm install @azure/ms-rest-browserauth
```

##### Sample code

See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.

- index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/arm-postgresql sample</title>
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/arm-postgresql/dist/arm-postgresql.js"></script>
<script type="text/javascript">
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.ArmPostgresql.PostgreSQLManagementClient(res.creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const serverName = "testserverName";
client.servers.get(resourceGroupName, serverName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
});
</script>
</head>
<body></body>
</html>
```

## Related projects

- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
69 changes: 67 additions & 2 deletions packages/@azure/arm-postgresql/lib/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export interface StorageProfile {
/**
* Contains the possible cases for ServerPropertiesForCreate.
*/
export type ServerPropertiesForCreateUnion = ServerPropertiesForCreate | ServerPropertiesForDefaultCreate | ServerPropertiesForRestore | ServerPropertiesForGeoRestore;
export type ServerPropertiesForCreateUnion = ServerPropertiesForCreate | ServerPropertiesForDefaultCreate | ServerPropertiesForRestore | ServerPropertiesForGeoRestore | ServerPropertiesForReplica;

/**
* @interface
Expand Down Expand Up @@ -222,6 +222,38 @@ export interface ServerPropertiesForGeoRestore {
sourceServerId: string;
}

/**
* @interface
* An interface representing ServerPropertiesForReplica.
* The properties to create a new replica.
*
*/
export interface ServerPropertiesForReplica {
/**
* @member {string} createMode Polymorphic Discriminator
*/
createMode: "Replica";
/**
* @member {ServerVersion} [version] Server version. Possible values include:
* '9.5', '9.6', '10', '10.0', '10.2'
*/
version?: ServerVersion;
/**
* @member {SslEnforcementEnum} [sslEnforcement] Enable ssl enforcement or
* not when connect to server. Possible values include: 'Enabled', 'Disabled'
*/
sslEnforcement?: SslEnforcementEnum;
/**
* @member {StorageProfile} [storageProfile] Storage profile of a server.
*/
storageProfile?: StorageProfile;
/**
* @member {string} sourceServerId The master server id to create replica
* from.
*/
sourceServerId: string;
}

/**
* @interface
* An interface representing Sku.
Expand Down Expand Up @@ -302,6 +334,20 @@ export interface Server extends TrackedResource {
* @member {StorageProfile} [storageProfile] Storage profile of a server.
*/
storageProfile?: StorageProfile;
/**
* @member {string} [replicationRole] The replication role of the server.
*/
replicationRole?: string;
/**
* @member {string} [masterServerId] The master server id of a replica
* server.
*/
masterServerId?: string;
/**
* @member {number} [replicaCapacity] The maximum number of replicas that a
* master server can have.
*/
replicaCapacity?: number;
}

/**
Expand Down Expand Up @@ -334,7 +380,7 @@ export interface ServerForCreate {
/**
* @interface
* An interface representing ServerUpdateParameters.
* Parameters allowd to update for a server.
* Parameters allowed to update for a server.
*
*/
export interface ServerUpdateParameters {
Expand Down Expand Up @@ -1028,6 +1074,25 @@ export type ServersBeginUpdateResponse = Server & {
};
};

/**
* Contains response data for the listByServer operation.
*/
export type ReplicasListByServerResponse = ServerListResult & {
/**
* 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: ServerListResult;
};
};

/**
* Contains response data for the createOrUpdate operation.
*/
Expand Down
Loading

0 comments on commit c76ef5a

Please sign in to comment.