/// <summary>获取App信息</summary> public static async Task <AppInfo?> GetAppInfo(this IAppClusterClient client, CancellationToken cancellationToken = default) { if (client == null) { throw new ArgumentNullException(nameof(client)); } #if NET40 var list = await client.Get <IList <AppInfo> >("apps?appIds=" + WebUtility.UrlEncode(client.AppId), cancellationToken).ConfigureAwait(false); #else var list = await client.Get <IReadOnlyList <AppInfo> >("apps?appIds=" + WebUtility.UrlEncode(client.AppId), cancellationToken).ConfigureAwait(false); #endif return(list?.FirstOrDefault()); }
public static Task <IReadOnlyList <EnvCluster>?> GetEnvClusterInfo(this IAppClusterClient client, #endif CancellationToken cancellationToken = default) { if (client == null) { throw new ArgumentNullException(nameof(client)); } #if NET40 return(client.Get <IList <EnvCluster> >($"apps/{client.AppId}/envclusters", cancellationToken)); #else return(client.Get <IReadOnlyList <EnvCluster> >($"apps/{client.AppId}/envclusters", cancellationToken)); #endif }
/// <summary>获取App信息</summary> public static Task <IReadOnlyList <AppInfo>?> GetAppsInfo(this IAppClusterClient client, IReadOnlyCollection <string>?appIds = null, CancellationToken cancellationToken = default) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (appIds == null || appIds.Count == 0) { return(client.Get <IReadOnlyList <AppInfo> >("apps", cancellationToken)); } return(client.Get <IReadOnlyList <AppInfo> >($"apps?appIds={WebUtility.UrlEncode(string.Join(",", appIds))}", cancellationToken)); }
public static Task <IReadOnlyList <Namespace>?> GetNamespaces(this IAppClusterClient client, string env, #endif string clusterName = ConfigConsts.ClusterNameDefault, CancellationToken cancellationToken = default) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (env == null) { throw new ArgumentNullException(nameof(env)); } #if NET40 return(client.Get <IList <Namespace> >($"envs/{env}/apps/{client.AppId}/clusters/{clusterName}/namespaces", cancellationToken)); #else return(client.Get <IReadOnlyList <Namespace> >($"envs/{env}/apps/{client.AppId}/clusters/{clusterName}/namespaces", cancellationToken)); #endif }
/// <summary>获取集群</summary> public static Task <Cluster?> GetCluster(this IAppClusterClient client, string env, string clusterName = ConfigConsts.ClusterNameDefault, CancellationToken cancellationToken = default) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (env == null) { throw new ArgumentNullException(nameof(env)); } return(client.Get <Cluster>($"envs/{env}/apps/{client.AppId}/clusters/{clusterName}", cancellationToken)); }