-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #212 from OctopusDeploy/remove-extensibility-package
Remove extensibility package
- Loading branch information
Showing
10 changed files
with
284 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
source/Octopus.Client/Extensibility/Attributes/ApiPropertyAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System; | ||
|
||
namespace Octopus.Client.Extensibility.Attributes | ||
{ | ||
public abstract class ApiPropertyAttribute : Attribute | ||
{ | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
source/Octopus.Client/Extensibility/Attributes/WriteableAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
|
||
namespace Octopus.Client.Extensibility.Attributes | ||
{ | ||
/// <summary> | ||
/// Properties with this attribute will be persisted to the server when sent using a POST or PUT request. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Property)] | ||
public class WriteableAttribute : ApiPropertyAttribute | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Properties with this attribute will be persisted to the server when sent using a POST request. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Property)] | ||
public class WriteableOnCreateAttribute : ApiPropertyAttribute | ||
{ | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
...t/Extensibility/Extensions/Infrastructure/Configuration/ExtensionConfigurationResource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.ComponentModel; | ||
using System.ComponentModel.DataAnnotations; | ||
using Octopus.Client.Extensibility.Attributes; | ||
|
||
namespace Octopus.Client.Extensibility.Extensions.Infrastructure.Configuration | ||
{ | ||
public abstract class ExtensionConfigurationResource: IResource | ||
{ | ||
public string Id { get; set; } | ||
|
||
[DisplayName("Is Enabled")] | ||
[Description("Whether or not this extension is enabled")] | ||
[Required] | ||
[Writeable] | ||
public bool IsEnabled { get; set; } | ||
|
||
public LinkCollection Links { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System; | ||
|
||
namespace Octopus.Client.Extensibility | ||
{ | ||
public class Href : IEquatable<Href> | ||
{ | ||
readonly string link; | ||
|
||
public Href(string link) | ||
{ | ||
this.link = link; | ||
} | ||
|
||
public string AsString() | ||
{ | ||
return link; | ||
} | ||
|
||
public bool Equals(Href other) | ||
{ | ||
return string.Equals(link, other.link); | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != GetType()) return false; | ||
return Equals((Href)obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return (link != null ? link.GetHashCode() : 0); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return link; | ||
} | ||
|
||
public static bool operator ==(Href left, Href right) | ||
{ | ||
return Equals(left, right); | ||
} | ||
|
||
public static bool operator !=(Href left, Href right) | ||
{ | ||
return !Equals(left, right); | ||
} | ||
|
||
public static implicit operator String(Href href) | ||
{ | ||
return href.link; | ||
} | ||
|
||
public static implicit operator Href(string href) | ||
{ | ||
return new Href(href); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Octopus.Client.Extensibility | ||
{ | ||
public interface IResource | ||
{ | ||
string Id { get; } | ||
|
||
LinkCollection Links { get; set; } | ||
} | ||
|
||
public interface INamedResource | ||
{ | ||
string Name { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Octopus.Client.Extensibility | ||
{ | ||
public class LinkCollection : Dictionary<string, Href> | ||
{ | ||
public LinkCollection() | ||
: base(StringComparer.OrdinalIgnoreCase) | ||
{ | ||
} | ||
|
||
public new LinkCollection Add(string name, Href value) | ||
{ | ||
base.Add(name, value); | ||
return this; | ||
} | ||
|
||
public static LinkCollection Self(Href self) | ||
{ | ||
return new LinkCollection().Add("Self", self); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters