示例#1
0
def create(clients: Clients, project_id: str, slug: str, type: str, deployment_strategy: str) -> None:
    """Create service"""
    result = clients.contxt_deployments.post(
        f"{clients.org_id}/services",
        json={
            "project_id": project_id,
            "slug": slug,
            "type": type,
            "deployment_strategy": deployment_strategy,
        },
    )
    print_item(result)
示例#2
0
def create(
    clients: Clients,
    name: str,
    description: str,
    type: str,
    slug: Optional[str],
    owner_role_id: Optional[str],
) -> None:
    """Create a project"""
    result = clients.contxt_deployments.post(
        f"{clients.org_id}/projects",
        {
            "name": name,
            "slug": slug,
            "description": description,
            "type": type,
            "owner_role_id": owner_role_id,
        },
    )
    print_item(result)
示例#3
0
def register(
    clients: Clients,
    description: str,
    slug: str,
    host: str,
    environment_type: str,
    certificate_authority: str,
) -> None:
    result = clients.contxt_deployments.post(
        f"{clients.org_id}/clusters",
        json={
            "host": host,
            "slug": slug,
            "description": description,
            "type": "kubernetes",
            "environment_type": environment_type,
            "certificate_authority": certificate_authority,
        },
    )
    print_item(result)
示例#4
0
def create(
    clients: Clients,
    service_id: str,
    project_environment_id: Optional[str],
    name: str,
    slug: str,
    descriptor: str,
    service_type: str,
) -> None:
    """Create service instances"""
    json = {
        "name": name,
        "project_environment_id": project_environment_id,
        "slug": slug,
        "descriptor": descriptor,
        "service_type": service_type,
    }
    json = {k: v for k, v in json.items() if v is not None}
    result = clients.contxt_deployments.post(
        f"{clients.org_id}/services/{service_id}/service_instances", json)
    print_item(result)
示例#5
0
def create(
    clients: Clients,
    project_slug: str,
    name: str,
    slug: str,
    description: Optional[str],
    type: str,
    cluster_id: str,
    deployment_strategy: str,
) -> None:
    """Create a project environment"""
    result = clients.contxt_deployments.post(
        f"{clients.org_id}/projects/{project_slug}/environments",
        {
            "cluster_id": cluster_id,
            "slug": slug,
            "name": name,
            "type": type,
            "deployment_strategy": deployment_strategy,
            "description": description,
        },
    )
    print_item(result)
示例#6
0
def update(
    clients: Clients,
    curr_slug: str,
    host: Optional[str],
    description: Optional[str],
    environment_type: Optional[str],
    certificate_authority: Optional[str],
) -> None:
    """Update a cluster"""
    params = {
        k: v
        for k, v in {
            "host": host,
            "description": description,
            "environment_type": environment_type,
            "certificate_authority": certificate_authority,
        }.items() if v is not None
    }
    result = clients.contxt_deployments.put(
        f"{clients.org_id}/clusters/{curr_slug}",
        json=params,
    )
    print_item(result)