blob: f587c461e4b2b80d37be3e3e6e83d8191394c101 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: IgniteClientConfiguration.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: IgniteClientConfiguration.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const FS = require('fs');
const Util = require('util');
const Errors = require('./Errors');
const ArgumentChecker = require('./internal/ArgumentChecker');
/**
* Class representing Ignite client configuration.
*
* The configuration includes:
* - (mandatory) Ignite node endpoint(s)
* - (optional) user credentials for authentication
* - (optional) TLS enabling
* - (optional) connection options
*/
class IgniteClientConfiguration {
/**
* Creates an instance of Ignite client configuration
* with the provided mandatory settings and default optional settings.
*
* By default, the client does not use authentication and secure connection.
*
* @param {...string} endpoints - Ignite node endpoint(s).
* The client randomly connects/reconnects to one of the specified node.
*
* @return {IgniteClientConfiguration} - new client configuration instance.
*
* @throws {IgniteClientError} if error.
*/
constructor(...endpoints) {
ArgumentChecker.notEmpty(endpoints, 'endpoints');
this._endpoints = endpoints;
this._userName = null;
this._password = null;
this._useTLS = false;
this._options = null;
}
/**
* Sets username which will be used for authentication during the client's connection.
*
* If username is not set, the client does not use authentication during connection.
*
* @param {string} userName - username. If null, authentication is disabled.
*
* @return {IgniteClientConfiguration} - the same instance of the IgniteClientConfiguration.
*
* @throws {IgniteClientError} if error.
*/
setUserName(userName) {
this._userName = userName;
return this;
}
/**
* Sets password which will be used for authentication during the client's connection.
*
* Password is ignored, if username is not set.
* If password is not set, it is considered empty.
*
* @param {string} password - password. If null, password is empty.
*
* @return {IgniteClientConfiguration} - the same instance of the IgniteClientConfiguration.
*
* @throws {IgniteClientError} if error.
*/
setPassword(password) {
this._password = password;
return this;
}
/**
* Sets connection options.
*
* By default the client establishes a non-secure connection with default connection options defined by nodejs.
*
* @param {boolean} useTLS - if true, secure connection will be established;
* if false, non-secure connection will be established.
* @param {object} [connectionOptions=null] - connection options.
* - For non-secure connection options defined here {@link https://nodejs.org/api/net.html#net_net_createconnection_options_connectlistener}
* - For secure connection options defined here {@link https://nodejs.org/api/tls.html#tls_tls_connect_options_callback}
*
* @return {IgniteClientConfiguration} - the same instance of the IgniteClientConfiguration.
*/
setConnectionOptions(useTLS, connectionOptions = null) {
this._useTLS = useTLS;
this._options = connectionOptions;
return this;
}
}
module.exports = IgniteClientConfiguration;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BinaryObject.html">BinaryObject</a></li><li><a href="CacheClient.html">CacheClient</a></li><li><a href="CacheConfiguration.html">CacheConfiguration</a></li><li><a href="CacheEntry.html">CacheEntry</a></li><li><a href="CacheKeyConfiguration.html">CacheKeyConfiguration</a></li><li><a href="CollectionObjectType.html">CollectionObjectType</a></li><li><a href="ComplexObjectType.html">ComplexObjectType</a></li><li><a href="CompositeType.html">CompositeType</a></li><li><a href="Cursor.html">Cursor</a></li><li><a href="EnumItem.html">EnumItem</a></li><li><a href="IgniteClient.html">IgniteClient</a></li><li><a href="IgniteClientConfiguration.html">IgniteClientConfiguration</a></li><li><a href="IgniteClientError.html">IgniteClientError</a></li><li><a href="IllegalStateError.html">IllegalStateError</a></li><li><a href="LostConnectionError.html">LostConnectionError</a></li><li><a href="MapObjectType.html">MapObjectType</a></li><li><a href="ObjectArrayType.html">ObjectArrayType</a></li><li><a href="ObjectType.html">ObjectType</a></li><li><a href="OperationError.html">OperationError</a></li><li><a href="Query.html">Query</a></li><li><a href="QueryEntity.html">QueryEntity</a></li><li><a href="QueryField.html">QueryField</a></li><li><a href="QueryIndex.html">QueryIndex</a></li><li><a href="ScanQuery.html">ScanQuery</a></li><li><a href="SqlFieldsCursor.html">SqlFieldsCursor</a></li><li><a href="SqlFieldsQuery.html">SqlFieldsQuery</a></li><li><a href="SqlQuery.html">SqlQuery</a></li><li><a href="Timestamp.html">Timestamp</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue May 22 2018 12:08:48 GMT+0300 (Russia TZ 2 Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>