fc8262bad0
* Add failing test * Guard against overrding project settings accidentally * Throw exception in case of conflct * Update sdk/dotnet/Pulumi.Automation/DictionaryContentsComparer.cs Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com> * Update sdk/dotnet/Pulumi.Automation/ProjectRuntime.cs Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com> * Update sdk/dotnet/Pulumi.Automation/ProjectTemplateConfigValue.cs Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com> * Update sdk/dotnet/Pulumi.Automation/ProjectTemplate.cs Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com> * Update sdk/dotnet/Pulumi.Automation/ProjectRuntimeOptions.cs Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com> * Update sdk/dotnet/Pulumi.Automation/ProjectBackend.cs Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com> * Update sdk/dotnet/Pulumi.Automation/ProjectSettings.cs Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com> * Reduce nesting * Make the new exception public * Introduce a CHANGELOG entry since we add to pub API * Stricter check before throwing * Address PR feedback, round 1 * Use Reference.Equals check * Move DictionaryContentsComparer out of top-level Co-authored-by: Komal Ali <komal@pulumi.com> Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
// Copyright 2016-2021, Pulumi Corporation
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Pulumi.Automation
|
|
{
|
|
/// <summary>
|
|
/// Configuration for the project's Pulumi state storage backend.
|
|
/// </summary>
|
|
public class ProjectBackend
|
|
{
|
|
internal static IEqualityComparer<ProjectBackend> Comparer { get; } = new ProjectBackendComparer();
|
|
|
|
public string? Url { get; set; }
|
|
|
|
private sealed class ProjectBackendComparer : IEqualityComparer<ProjectBackend>
|
|
{
|
|
bool IEqualityComparer<ProjectBackend>.Equals(ProjectBackend? x, ProjectBackend? y)
|
|
{
|
|
if (x == null)
|
|
{
|
|
return y == null;
|
|
}
|
|
|
|
if (y == null)
|
|
{
|
|
return x == null;
|
|
}
|
|
|
|
if (ReferenceEquals(x, y))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return x.Url == y.Url;
|
|
}
|
|
|
|
int IEqualityComparer<ProjectBackend>.GetHashCode(ProjectBackend obj)
|
|
{
|
|
return HashCode.Combine(obj.Url);
|
|
}
|
|
}
|
|
}
|
|
}
|