示例#1
0
        public async Task <Versions> ListOneAgentAvailableVersionsAsync(OneAgentDeploymentOsTypes osType, OneAgentInstallerTypes installerType, LinuxDistributionFlavors?flavor = null, OsArchitectureTypes?arch = null,
                                                                        CancellationToken cancellationToken = default)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                [nameof(flavor)] = s_linuxDistributionFlavorsConverter.ConvertToString(flavor),
                [nameof(arch)]   = s_osArchitectureTypesConverter.ConvertToString(arch)
            };

            var response = await GetDeploymentOneAgentUrl()
                           .AppendPathSegment("versions")
                           .AppendPathSegment(s_oneAgentDeploymentOsTypesConverter.ConvertToString(osType))
                           .AppendPathSegment(s_oneAgentInstallerTypesConverter.ConvertToString(installerType))
                           .SetQueryParams(queryParamValues)
                           .GetJsonIfNotEmptyAsync(new Versions(), cancellationToken)
                           .ConfigureAwait(false);

            return(response);
        }
示例#2
0
        public async Task <InstallerMetaInfoDto> ViewOneAgentLatestVersionAsync(OneAgentDeploymentOsTypes osType, OneAgentInstallerTypes installerType, string version, LinuxDistributionFlavors?flavor = null,
                                                                                OsArchitectureTypes?arch = null, OsBitnessTypes?bitness = null, CancellationToken cancellationToken = default)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                [nameof(flavor)]  = s_linuxDistributionFlavorsConverter.ConvertToString(flavor),
                [nameof(arch)]    = s_osArchitectureTypesConverter.ConvertToString(arch),
                [nameof(bitness)] = s_osBitnessTypesConverter.ConvertToString(bitness)
            };

            var response = await GetDeploymentOneAgentUrl()
                           .AppendPathSegment(s_oneAgentDeploymentOsTypesConverter.ConvertToString(osType))
                           .AppendPathSegment(s_oneAgentInstallerTypesConverter.ConvertToString(installerType))
                           .AppendPathSegment("latest")
                           .AppendPathSegment("metainfo")
                           .SetQueryParams(queryParamValues)
                           .GetJsonWithErrorCheckingAsync <InstallerMetaInfoDto>(cancellationToken)
                           .ConfigureAwait(false);

            return(response);
        }
示例#3
0
        public async Task <bool> DownloadOneAgentSpecificVersionAsync(OneAgentDeploymentOsTypes osType, OneAgentInstallerTypes installerType, string version, LinuxDistributionFlavors?flavor = null,
                                                                      OsArchitectureTypes?arch            = null, OsBitnessTypes?bitness = null, IEnumerable <string> include = null, bool?skipMetadata = false, string ifNoneMatchEtag = null,
                                                                      CancellationToken cancellationToken = default)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                [nameof(flavor)]       = s_linuxDistributionFlavorsConverter.ConvertToString(flavor),
                [nameof(arch)]         = s_osArchitectureTypesConverter.ConvertToString(arch),
                [nameof(bitness)]      = s_osBitnessTypesConverter.ConvertToString(bitness),
                [nameof(include)]      = include == null ? null : string.Join("&", include.Select(x => $"include={x}")),
                [nameof(skipMetadata)] = skipMetadata
            };

            var response = await GetDeploymentOneAgentUrl()
                           .WithHeader("If-None-Match", ifNoneMatchEtag)
                           .AppendPathSegment(s_oneAgentDeploymentOsTypesConverter.ConvertToString(osType))
                           .AppendPathSegment(s_oneAgentInstallerTypesConverter.ConvertToString(installerType))
                           .AppendPathSegment("version")
                           .AppendPathSegment(version)
                           .SetQueryParams(queryParamValues)
                           .GetAsync(cancellationToken)
                           .ConfigureAwait(false);

            return(response.IsSuccessStatusCode);
        }