示例#1
0
        protected override async Task <bool> PublishConfig(string dataId, string group, string tenant, string appName, string tag, string betaIps, string content, string encryptedDataKey, string casMd5, string type)
        {
            try
            {
                var request = new ConfigPublishRequest(dataId, group, tenant, content);
                request.PutAdditonalParam(ConfigConstants.TAG, tag);
                request.PutAdditonalParam(ConfigConstants.APP_NAME, appName);
                request.PutAdditonalParam(ConfigConstants.BETAIPS, betaIps);
                request.PutAdditonalParam(ConfigConstants.TYPE, type);
                request.PutAdditonalParam(ConfigConstants.ENCRYPTED_DATA_KEY, encryptedDataKey);

                var response = await RequestProxy(GetOneRunningClient(), request).ConfigureAwait(false);

                if (!response.IsSuccess())
                {
                    _logger?.LogWarning("[{0}] [publish-single] fail, dataId={1}, group={2}, tenant={3}, code={4}, msg={5}", this.GetName(), dataId, group, tenant, response.ErrorCode, response.Message);
                    return(false);
                }
                else
                {
                    _logger?.LogInformation("[{0}] [publish-single] ok, dataId={1}, group={2}, tenant={3}, config={4}", this.GetName(), dataId, group, tenant, ContentUtils.TruncateContent(content));
                    return(true);
                }
            }
            catch (Exception ex)
            {
                _logger?.LogWarning(ex, "[{0}] [publish-single] error, dataId={1}, group={2}, tenant={3}, code={4}", this.GetName(), dataId, group, tenant, "unkonw");
                return(false);
            }
        }
示例#2
0
        protected override async Task <bool> PublishConfig(string dataId, string group, string tenant, string appName, string tag, string betaIps, string content)
        {
            try
            {
                var request = new ConfigPublishRequest(dataId, group, tenant, content);
                request.PutAdditonalParam("tag", tag);
                request.PutAdditonalParam("appName", appName);
                request.PutAdditonalParam("betaIps", betaIps);

                var response = await RequestProxy(GetOneRunningClient(), request);

                return(response.IsSuccess());
            }
            catch (Exception ex)
            {
                _logger?.LogWarning(ex, "[{0}] [publish-single] error, dataId={1}, group={2}, tenant={3}, code={4}", this.GetName(), dataId, group, tenant, "unkonw");
                return(false);
            }
        }