def select(endpoint, cert=None, key=None, pem=None, ca=None, <EOL>aad=False, no_verify=False):<EOL>
from sfctl.config import (set_ca_cert, set_auth, set_aad_cache,<EOL>set_cluster_endpoint,<EOL>set_no_verify)<EOL>from msrest import ServiceClient, Configuration<EOL>from sfctl.auth import ClientCertAuthentication, AdalAuthentication<EOL>select_arg_verify(endpoint, cert, key, pem, ca, aad, no_verify)<EOL>if aad:<EOL><INDENT>new_token, new_cache = get_aad_token(endpoint, no_verify)<EOL>set_aad_cache(new_token, new_cache)<EOL>rest_client = ServiceClient(<EOL>AdalAuthentication(no_verify),<EOL>Configuration(endpoint)<EOL>)<EOL>rest_client.send(rest_client.get('<STR_LIT:/>')).raise_for_status()<EOL><DEDENT>else:<EOL><INDENT>client_cert = None<EOL>if pem:<EOL><INDENT>client_cert = pem<EOL><DEDENT>elif cert:<EOL><INDENT>client_cert = (cert, key)<EOL><DEDENT>rest_client = ServiceClient(<EOL>ClientCertAuthentication(client_cert, ca, no_verify),<EOL>Configuration(endpoint)<EOL>)<EOL>rest_client.send(rest_client.get('<STR_LIT:/>')).raise_for_status()<EOL><DEDENT>set_cluster_endpoint(endpoint)<EOL>set_no_verify(no_verify)<EOL>set_ca_cert(ca)<EOL>set_auth(pem, cert, key, aad)<EOL>
Connects to a Service Fabric cluster endpoint.
If connecting to secure cluster specify an absolute path to a cert (.crt)
and key file (.key) or a single file with both (.pem). Do not specify both.
Optionally, if connecting to a secure cluster, specify also an absolute
path to a CA bundle file or directory of trusted CA certs.
:param str endpoint: Cluster endpoint URL, including port and HTTP or HTTPS
prefix
:param str cert: Absolute path to a client certificate file
:param str key: Absolute path to client certificate key file
:param str pem: Absolute path to client certificate, as a .pem file
:param str ca: Absolute path to CA certs directory to treat as valid
or CA bundle
file
:param bool aad: Use Azure Active Directory for authentication
:param bool no_verify: Disable verification for certificates when using
HTTPS, note: this is an insecure option and should not be used for
production environments