Example #1
0
    def __init__(self, host='localhost', port=None, protocol=DEFAULT_PROTOCOL,
                 api_version=DEFAULT_API_VERSION, headers=None,
                 query_params=None, cert=None, trust_all=False,
                 username=None, password=None, token=None, tenant=None,
                 kerberos_env=None, timeout=None, session=None):
        """
        Creates a Cloudify client with the provided host and optional port.

        :param host: Host of Cloudify's management machine.
        :param port: Port of REST API service on management machine.
        :param protocol: Protocol of REST API service on management machine,
                        defaults to http.
        :param api_version: version of REST API service on management machine.
        :param headers: Headers to be added to request.
        :param query_params: Query parameters to be added to the request.
        :param cert: Path to a copy of the server's self-signed certificate.
        :param trust_all: if `False`, the server's certificate
                          (self-signed or not) will be verified.
        :param username: Cloudify User username.
        :param password: Cloudify User password.
        :param token: Cloudify User token.
        :param tenant: Cloudify Tenant name.
        :param timeout: Requests timeout value. If not set, will default to
                        (5, None)- 5 seconds connect timeout, no read timeout.
        :param session: a requests.Session to use for all HTTP calls
        :return: Cloudify client instance.
        """

        if not port:
            if protocol == SECURED_PROTOCOL:
                # SSL
                port = SECURED_PORT
            else:
                port = DEFAULT_PORT

        self.host = host
        self._client = self.client_class(host, port, protocol, api_version,
                                         headers, query_params, cert,
                                         trust_all, username, password,
                                         token, tenant, kerberos_env, timeout,
                                         session)
        self.blueprints = BlueprintsClient(self._client)
        self.idp = IdentityProviderClient(self._client)
        self.permissions = PermissionsClient(self._client)
        self.snapshots = SnapshotsClient(self._client)
        self.log_bundles = LogBundlesClient(self._client)
        self.deployments = DeploymentsClient(self._client)
        self.deployment_groups = DeploymentGroupsClient(self._client)
        self.executions = ExecutionsClient(self._client)
        self.execution_groups = ExecutionGroupsClient(self._client)
        self.execution_schedules = ExecutionSchedulesClient(self._client)
        self.nodes = NodesClient(self._client)
        self.node_instances = NodeInstancesClient(self._client)
        self.manager = ManagerClient(self._client)
        self.events = EventsClient(self._client)
        self.evaluate = EvaluateClient(self._client)
        self.deployment_modifications = DeploymentModificationsClient(
            self._client)
        self.tokens = TokensClient(self._client)
        self.plugins = PluginsClient(self._client)
        self.plugins_update = PluginsUpdateClient(self._client)
        self.maintenance_mode = MaintenanceModeClient(self._client)
        self.deployment_updates = DeploymentUpdatesClient(self._client)
        self.tenants = TenantsClient(self._client)
        self.user_groups = UserGroupsClient(self._client)
        self.users = UsersClient(self._client)
        self.ldap = LdapClient(self._client)
        self.secrets = SecretsClient(self._client)
        self.agents = AgentsClient(self._client)
        self.summary = SummariesClient(self._client)
        self.operations = OperationsClient(self._client)
        self.tasks_graphs = TasksGraphClient(self._client)
        self.license = LicenseClient(self._client)
        self.sites = SitesClient(self._client)
        self.cluster_status = ClusterStatusClient(self._client)
        self.inter_deployment_dependencies = InterDeploymentDependencyClient(
            self._client)
        self.deployments_filters = DeploymentsFiltersClient(self._client)
        self.blueprints_filters = BlueprintsFiltersClient(self._client)
        self.deployments_labels = DeploymentsLabelsClient(self._client)
        self.blueprints_labels = BlueprintsLabelsClient(self._client)
        self.workflows = WorkflowsClient(self._client)
        if AuditLogAsyncClient is None:
            self.auditlog = AuditLogClient(self._client)
        else:
            self.auditlog = AuditLogAsyncClient(self._client)
Example #2
0
    def __init__(self,
                 host='localhost',
                 port=None,
                 protocol=DEFAULT_PROTOCOL,
                 api_version=DEFAULT_API_VERSION,
                 headers=None,
                 query_params=None,
                 cert=None,
                 trust_all=False,
                 username=None,
                 password=None,
                 token=None,
                 tenant=None,
                 kerberos_env=None):
        """
        Creates a Cloudify client with the provided host and optional port.

        :param host: Host of Cloudify's management machine.
        :param port: Port of REST API service on management machine.
        :param protocol: Protocol of REST API service on management machine,
                        defaults to http.
        :param api_version: version of REST API service on management machine.
        :param headers: Headers to be added to request.
        :param query_params: Query parameters to be added to the request.
        :param cert: Path to a copy of the server's self-signed certificate.
        :param trust_all: if `False`, the server's certificate
                          (self-signed or not) will be verified.
        :param username: Cloudify User username.
        :param password: Cloudify User password.
        :param token: Cloudify User token.
        :param tenant: Cloudify Tenant name.
        :return: Cloudify client instance.
        """

        if not port:
            if protocol == SECURED_PROTOCOL:
                # SSL
                port = SECURED_PORT
            else:
                port = DEFAULT_PORT

        self.host = host
        self._client = self.client_class(host, port, protocol, api_version,
                                         headers, query_params, cert,
                                         trust_all, username, password, token,
                                         tenant, kerberos_env)
        self.blueprints = BlueprintsClient(self._client)
        self.snapshots = SnapshotsClient(self._client)
        self.deployments = DeploymentsClient(self._client)
        self.executions = ExecutionsClient(self._client)
        self.nodes = NodesClient(self._client)
        self.node_instances = NodeInstancesClient(self._client)
        self.manager = ManagerClient(self._client)
        self.events = EventsClient(self._client)
        self.evaluate = EvaluateClient(self._client)
        self.deployment_modifications = DeploymentModificationsClient(
            self._client)
        self.tokens = TokensClient(self._client)
        self.plugins = PluginsClient(self._client)
        self.plugins_update = PluginsUpdateClient(self._client)
        self.maintenance_mode = MaintenanceModeClient(self._client)
        self.deployment_updates = DeploymentUpdatesClient(self._client)
        self.tenants = TenantsClient(self._client)
        self.user_groups = UserGroupsClient(self._client)
        self.users = UsersClient(self._client)
        self.ldap = LdapClient(self._client)
        self.secrets = SecretsClient(self._client)
        self.agents = AgentsClient(self._client)
        self.summary = SummariesClient(self._client)
        self.user_tokens = UserTokensClient(self._client)
        self.operations = OperationsClient(self._client)
        self.tasks_graphs = TasksGraphClient(self._client)
        self.license = LicenseClient(self._client)
        self.sites = SitesClient(self._client)