Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 42 additions & 5 deletions cs/src/Contracts/TunnelServiceProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public class TunnelServiceProperties
/// </summary>
internal const string DevDnsName = "global.ci.tunnels.dev.api.visualstudio.com";

/// <summary>
/// Default host name for the local tunnel service.
/// </summary>
internal const string LocalDnsName = "tunnels.local.api.visualstudio.com:9901";

/// <summary>
/// First-party app ID: `Visual Studio Tunnel Service`
/// </summary>
Expand Down Expand Up @@ -95,10 +100,28 @@ public class TunnelServiceProperties
/// GitHub App Client ID for 'Visual Studio Tunnel Service - Test'
/// </summary>
/// <remarks>
/// Used by client apps that authenticate tunnel users with GitHub, in the PPE and DEV
/// service environments.
/// Used by client apps that authenticate tunnel users with GitHub, in the PPE
/// service environment.
/// </remarks>
internal const string PpeGitHubAppClientId = "Iv1.b231c327f1eaa229";

/// <summary>
/// GitHub App Client ID for 'Dev Tunnels Service - Dev'
/// </summary>
/// <remarks>
/// Used by client apps that authenticate tunnel users with GitHub, in the DEV
/// service environment.
/// </remarks>
internal const string DevGitHubAppClientId = "Iv23ctTiak9wLCiTcEbr";

/// <summary>
/// GitHub App Client ID for 'Dev Tunnels Service - Local'
/// </summary>
/// <remarks>
/// Used by client apps that authenticate tunnel users with GitHub, when running
/// the service locally.
/// </remarks>
internal const string NonProdGitHubAppClientId = "Iv1.b231c327f1eaa229";
internal const string LocalGitHubAppClientId = "Iv23cttBYzKThF88PiPR";

private TunnelServiceProperties(
string serviceUri,
Expand Down Expand Up @@ -128,7 +151,7 @@ private TunnelServiceProperties(
$"https://{PpeDnsName}/",
PpeFirstPartyAppId,
PpeThirdPartyAppId,
NonProdGitHubAppClientId);
PpeGitHubAppClientId);

/// <summary>
/// Gets properties for the service in the development environment.
Expand All @@ -137,7 +160,20 @@ private TunnelServiceProperties(
$"https://{DevDnsName}/",
DevFirstPartyAppId,
DevThirdPartyAppId,
NonProdGitHubAppClientId);
DevGitHubAppClientId);

/// <summary>
/// Gets properties for the service when running locally.
/// </summary>
/// <remarks>
/// Uses the same service app IDs as the development environment, but a different
/// GitHub app with localhost callback URLs.
/// </remarks>
public static TunnelServiceProperties Local { get; } = new TunnelServiceProperties(
$"https://{LocalDnsName}/",
DevFirstPartyAppId,
DevThirdPartyAppId,
LocalGitHubAppClientId);

/// <summary>
/// Gets properties for the service in the specified environment.
Expand All @@ -157,6 +193,7 @@ public static TunnelServiceProperties Environment(string environmentName)
"prod" or "production" => TunnelServiceProperties.Production,
"ppe" or "preprod" or "staging" => TunnelServiceProperties.Staging,
"dev" or "development" => TunnelServiceProperties.Development,
"local" => TunnelServiceProperties.Local,
_ => throw new ArgumentException($"Invalid service environment: {environmentName}"),
};
}
Expand Down
38 changes: 19 additions & 19 deletions go/tunnels/cluster_details.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/ClusterDetails.cs

package tunnels

// Details of a tunneling service cluster. Each cluster represents an instance of the
// tunneling service running in a particular Azure region. New tunnels are created in the
// current region unless otherwise specified.
type ClusterDetails struct {
// A cluster identifier based on its region.
ClusterID string `json:"clusterId"`

// The URI of the service cluster.
URI string `json:"uri"`

// The Azure location of the cluster.
AzureLocation string `json:"azureLocation"`
}
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/ClusterDetails.cs
package tunnels
// Details of a tunneling service cluster. Each cluster represents an instance of the
// tunneling service running in a particular Azure region. New tunnels are created in the
// current region unless otherwise specified.
type ClusterDetails struct {
// A cluster identifier based on its region.
ClusterID string `json:"clusterId"`
// The URI of the service cluster.
URI string `json:"uri"`
// The Azure location of the cluster.
AzureLocation string `json:"azureLocation"`
}
40 changes: 20 additions & 20 deletions go/tunnels/error_codes.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/ErrorCodes.cs

package tunnels

// Error codes for ErrorDetail.Code and `x-ms-error-code` header.
type ErrorCodes []ErrorCode
type ErrorCode string

const (
// Operation timed out.
ErrorCodeTimeout ErrorCode = "Timeout"

// Operation cannot be performed because the service is not available.
ErrorCodeServiceUnavailable ErrorCode = "ServiceUnavailable"

// Internal error.
ErrorCodeInternalError ErrorCode = "InternalError"
)
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/ErrorCodes.cs
package tunnels
// Error codes for ErrorDetail.Code and `x-ms-error-code` header.
type ErrorCodes []ErrorCode
type ErrorCode string
const (
// Operation timed out.
ErrorCodeTimeout ErrorCode = "Timeout"
// Operation cannot be performed because the service is not available.
ErrorCodeServiceUnavailable ErrorCode = "ServiceUnavailable"
// Internal error.
ErrorCodeInternalError ErrorCode = "InternalError"
)
48 changes: 24 additions & 24 deletions go/tunnels/error_detail.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/ErrorDetail.cs

package tunnels

// The top-level error object whose code matches the x-ms-error-code response header
type ErrorDetail struct {
// One of a server-defined set of error codes defined in `ErrorCodes`.
Code string `json:"code"`

// A human-readable representation of the error.
Message string `json:"message"`

// The target of the error.
Target string `json:"target,omitempty"`

// An array of details about specific errors that led to this reported error.
Details []ErrorDetail `json:"details,omitempty"`

// An object containing more specific information than the current object about the
// error.
InnerError *InnerErrorDetail `json:"innererror,omitempty"`
}
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/ErrorDetail.cs
package tunnels
// The top-level error object whose code matches the x-ms-error-code response header
type ErrorDetail struct {
// One of a server-defined set of error codes defined in `ErrorCodes`.
Code string `json:"code"`
// A human-readable representation of the error.
Message string `json:"message"`
// The target of the error.
Target string `json:"target,omitempty"`
// An array of details about specific errors that led to this reported error.
Details []ErrorDetail `json:"details,omitempty"`
// An object containing more specific information than the current object about the
// error.
InnerError *InnerErrorDetail `json:"innererror,omitempty"`
}
32 changes: 16 additions & 16 deletions go/tunnels/inner_error_detail.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/InnerErrorDetail.cs

package tunnels

// An object containing more specific information than the current object about the error.
type InnerErrorDetail struct {
// A more specific error code than was provided by the containing error. One of a
// server-defined set of error codes in `ErrorCodes`.
Code string `json:"code"`

// An object containing more specific information than the current object about the
// error.
InnerError *InnerErrorDetail `json:"innererror,omitempty"`
}
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/InnerErrorDetail.cs
package tunnels
// An object containing more specific information than the current object about the error.
type InnerErrorDetail struct {
// A more specific error code than was provided by the containing error. One of a
// server-defined set of error codes in `ErrorCodes`.
Code string `json:"code"`
// An object containing more specific information than the current object about the
// error.
InnerError *InnerErrorDetail `json:"innererror,omitempty"`
}
11 changes: 9 additions & 2 deletions go/tunnels/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@ var PpeServiceProperties = TunnelServiceProperties{
ServiceURI: fmt.Sprintf("https://%s/", ppeDnsName),
ServiceAppID: ppeFirstPartyAppID,
ServiceInternalAppID: ppeThirdPartyAppID,
GitHubAppClientID: nonProdGitHubAppClientID,
GitHubAppClientID: ppeGitHubAppClientID,
}

var DevServiceProperties = TunnelServiceProperties{
ServiceURI: fmt.Sprintf("https://%s/", devDnsName),
ServiceAppID: devFirstPartyAppID,
ServiceInternalAppID: devThirdPartyAppID,
GitHubAppClientID: nonProdGitHubAppClientID,
GitHubAppClientID: devGitHubAppClientID,
}

var LocalServiceProperties = TunnelServiceProperties{
ServiceURI: fmt.Sprintf("https://%s/", localDnsName),
ServiceAppID: devFirstPartyAppID,
ServiceInternalAppID: devThirdPartyAppID,
GitHubAppClientID: localGitHubAppClientID,
}

type tokenProviderfn func() string
Expand Down
44 changes: 22 additions & 22 deletions go/tunnels/problem_details.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/ProblemDetails.cs

package tunnels

// Structure of error details returned by the tunnel service, including validation errors.
//
// This object may be returned with a response status code of 400 (or other 4xx code). It
// is compatible with RFC 7807 Problem Details (https://tools.ietf.org/html/rfc7807) and
// https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.problemdetails but
// doesn't require adding a dependency on that package.
type ProblemDetails struct {
// Gets or sets the error title.
Title string `json:"title,omitempty"`

// Gets or sets the error detail.
Detail string `json:"detail,omitempty"`

// Gets or sets additional details about individual request properties.
Errors map[string][]string `json:"errors,omitempty"`
}
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Generated from ../../../cs/src/Contracts/ProblemDetails.cs
package tunnels
// Structure of error details returned by the tunnel service, including validation errors.
//
// This object may be returned with a response status code of 400 (or other 4xx code). It
// is compatible with RFC 7807 Problem Details (https://tools.ietf.org/html/rfc7807) and
// https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.problemdetails but
// doesn't require adding a dependency on that package.
type ProblemDetails struct {
// Gets or sets the error title.
Title string `json:"title,omitempty"`
// Gets or sets the error detail.
Detail string `json:"detail,omitempty"`
// Gets or sets additional details about individual request properties.
Errors map[string][]string `json:"errors,omitempty"`
}
Loading
Loading