mirror of
https://github.com/actions/runner.git
synced 2025-12-18 16:26:58 +00:00
Remove old "v1" artifact download/publish code (#212)
* Remove old v1 artifact download/publish code * Remove the Build2 REST API SDK
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using GitHub.Services.Common;
|
||||
|
||||
namespace GitHub.Build.WebApi
|
||||
{
|
||||
public static class ArtifactResourceTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// Build container reference
|
||||
/// E.g. #/2121/drop
|
||||
/// </summary>
|
||||
public const String Container = "Container";
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using GitHub.Services.Common;
|
||||
using GitHub.Services.WebApi;
|
||||
using GitHub.Services.WebApi.Patch;
|
||||
using GitHub.Services.WebApi.Patch.Json;
|
||||
|
||||
namespace GitHub.Build.WebApi
|
||||
{
|
||||
public class BuildHttpClient : BuildHttpClientBase
|
||||
{
|
||||
static BuildHttpClient()
|
||||
{
|
||||
}
|
||||
|
||||
public BuildHttpClient(
|
||||
Uri baseUrl,
|
||||
VssCredentials credentials)
|
||||
: base(baseUrl, credentials)
|
||||
{
|
||||
}
|
||||
|
||||
public BuildHttpClient(
|
||||
Uri baseUrl,
|
||||
VssCredentials credentials,
|
||||
VssHttpRequestSettings settings)
|
||||
: base(baseUrl, credentials, settings)
|
||||
{
|
||||
}
|
||||
|
||||
public BuildHttpClient(
|
||||
Uri baseUrl,
|
||||
VssCredentials credentials,
|
||||
params DelegatingHandler[] handlers)
|
||||
: base(baseUrl, credentials, handlers)
|
||||
{
|
||||
}
|
||||
|
||||
public BuildHttpClient(
|
||||
Uri baseUrl,
|
||||
VssCredentials credentials,
|
||||
VssHttpRequestSettings settings,
|
||||
params DelegatingHandler[] handlers)
|
||||
: base(baseUrl, credentials, settings, handlers)
|
||||
{
|
||||
}
|
||||
|
||||
public BuildHttpClient(
|
||||
Uri baseUrl,
|
||||
HttpMessageHandler pipeline,
|
||||
Boolean disposeHandler)
|
||||
: base(baseUrl, pipeline, disposeHandler)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GitHub.Build.WebApi
|
||||
{
|
||||
public static class BuildResourceIds
|
||||
{
|
||||
public const String AreaId = "5D6898BB-45EC-463F-95F9-54D49C71752E";
|
||||
public const String AreaName = "build";
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GitHub.Build.WebApi
|
||||
{
|
||||
public static class BuildVariables
|
||||
{
|
||||
public const String TeamProjectId = "system.teamProjectId";
|
||||
|
||||
public const String BuildId = "build.buildId";
|
||||
public const String BuildNumber = "build.buildNumber";
|
||||
public const String ContainerId = "build.containerId";
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.Build.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class ArtifactResource : BaseSecuredObject
|
||||
{
|
||||
public ArtifactResource()
|
||||
{
|
||||
}
|
||||
|
||||
public ArtifactResource(
|
||||
ISecuredObject securedObject)
|
||||
: base(securedObject)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The type of the resource: File container, version control folder, UNC path, etc.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Type
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Type-specific data about the artifact.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For example, "#/10002/5/drop", "$/drops/5", "\\myshare\myfolder\mydrops\5"
|
||||
/// </remarks>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Data
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Type-specific properties of the artifact.
|
||||
/// </summary>
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false)]
|
||||
public Dictionary<String, String> Properties
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.Build.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an artifact produced by a build.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class BuildArtifact : BaseSecuredObject
|
||||
{
|
||||
public BuildArtifact()
|
||||
{
|
||||
}
|
||||
|
||||
internal BuildArtifact(
|
||||
ISecuredObject securedObject)
|
||||
: base(securedObject)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The artifact ID.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name of the artifact.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The artifact source, which will be the ID of the job that produced this artifact.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String Source
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The actual resource.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public ArtifactResource Resource
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* ---------------------------------------------------------
|
||||
* Copyright(C) Microsoft Corporation. All rights reserved.
|
||||
* ---------------------------------------------------------
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using GitHub.Services.Common;
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.Build.WebApi
|
||||
{
|
||||
[ResourceArea(BuildResourceIds.AreaId)]
|
||||
public abstract class BuildHttpClientBase : VssHttpClientBase
|
||||
{
|
||||
public BuildHttpClientBase(Uri baseUrl, VssCredentials credentials)
|
||||
: base(baseUrl, credentials)
|
||||
{
|
||||
}
|
||||
|
||||
public BuildHttpClientBase(Uri baseUrl, VssCredentials credentials, VssHttpRequestSettings settings)
|
||||
: base(baseUrl, credentials, settings)
|
||||
{
|
||||
}
|
||||
|
||||
public BuildHttpClientBase(Uri baseUrl, VssCredentials credentials, params DelegatingHandler[] handlers)
|
||||
: base(baseUrl, credentials, handlers)
|
||||
{
|
||||
}
|
||||
|
||||
public BuildHttpClientBase(Uri baseUrl, VssCredentials credentials, VssHttpRequestSettings settings, params DelegatingHandler[] handlers)
|
||||
: base(baseUrl, credentials, settings, handlers)
|
||||
{
|
||||
}
|
||||
|
||||
public BuildHttpClientBase(Uri baseUrl, HttpMessageHandler pipeline, bool disposeHandler)
|
||||
: base(baseUrl, pipeline, disposeHandler)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API] Associates an artifact with a build.
|
||||
/// </summary>
|
||||
/// <param name="artifact">The artifact.</param>
|
||||
/// <param name="project">Project ID</param>
|
||||
/// <param name="buildId">The ID of the build.</param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<BuildArtifact> CreateArtifactAsync(
|
||||
BuildArtifact artifact,
|
||||
Guid project,
|
||||
int buildId,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("POST");
|
||||
Guid locationId = new Guid("1db06c96-014e-44e1-ac91-90b2d4b3e984");
|
||||
object routeValues = new { project = project, buildId = buildId };
|
||||
HttpContent content = new ObjectContent<BuildArtifact>(artifact, new VssJsonMediaTypeFormatter(true));
|
||||
|
||||
return SendAsync<BuildArtifact>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion(5.2, 5),
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken,
|
||||
content: content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API] Gets a specific artifact for a build.
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID</param>
|
||||
/// <param name="buildId">The ID of the build.</param>
|
||||
/// <param name="artifactName">The name of the artifact.</param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<BuildArtifact> GetArtifactAsync(
|
||||
Guid project,
|
||||
int buildId,
|
||||
string artifactName,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("GET");
|
||||
Guid locationId = new Guid("1db06c96-014e-44e1-ac91-90b2d4b3e984");
|
||||
object routeValues = new { project = project, buildId = buildId };
|
||||
|
||||
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
|
||||
queryParams.Add("artifactName", artifactName);
|
||||
|
||||
return SendAsync<BuildArtifact>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion(5.2, 5),
|
||||
queryParameters: queryParams,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user