mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
[Feat] Add Advanced Security Properties to Repository Get/Update (#2865)
* add SecurityAndAnalysis to repository get/update * add repository advanced security * cleanup --------- Co-authored-by: Dirty Gooback <19241000+dirtygooback@users.noreply.github.com> Co-authored-by: Nick Floyd <139819+nickfloyd@users.noreply.github.com>
This commit is contained in:
12
Octokit/Models/Common/Status.cs
Normal file
12
Octokit/Models/Common/Status.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Octokit.Internal;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
public enum Status
|
||||
{
|
||||
[Parameter(Value = "enabled")]
|
||||
Enabled,
|
||||
[Parameter(Value = "disabled")]
|
||||
Disabled
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Octokit.Internal;
|
||||
using Octokit.Models.Response;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
@@ -133,6 +134,8 @@ namespace Octokit
|
||||
/// </summary>
|
||||
public bool? HasDiscussions { get; set; }
|
||||
|
||||
public SecurityAndAnalysisRequest SecurityAndAnalysis { get; set; }
|
||||
|
||||
internal string DebuggerDisplay => new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
|
||||
184
Octokit/Models/Request/SecurityAndAnalysisRequest.cs
Normal file
184
Octokit/Models/Request/SecurityAndAnalysisRequest.cs
Normal file
@@ -0,0 +1,184 @@
|
||||
using Octokit.Internal;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// The security and analysis features that are enabled or disabled for the repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class SecurityAndAnalysisRequest
|
||||
{
|
||||
public SecurityAndAnalysisRequest()
|
||||
{ }
|
||||
|
||||
public SecurityAndAnalysisRequest(AdvancedSecurityRequest advancedSecurity, DependabotSecurityUpdatesRequest dependabotSecurityUpdates,
|
||||
SecretScanningRequest secretScanning, SecretScanningPushProtectionRequest secretScanningPushProtection,
|
||||
SecretScanningValidityChecksRequest secretScanningValidityChecks)
|
||||
{
|
||||
this.AdvancedSecurity = advancedSecurity;
|
||||
this.DependabotSecurityUpdates = dependabotSecurityUpdates;
|
||||
this.SecretScanning = secretScanning;
|
||||
this.SecretScanningPushProtection = secretScanningPushProtection;
|
||||
this.SecretScanningValidityChecks = secretScanningValidityChecks;
|
||||
}
|
||||
|
||||
|
||||
public AdvancedSecurityRequest AdvancedSecurity { get; set; }
|
||||
public DependabotSecurityUpdatesRequest DependabotSecurityUpdates { get; set; }
|
||||
public SecretScanningRequest SecretScanning { get; set; }
|
||||
public SecretScanningPushProtectionRequest SecretScanningPushProtection { get; set; }
|
||||
public SecretScanningValidityChecksRequest SecretScanningValidityChecks { get; set; }
|
||||
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Use the status property to enable or disable GitHub Advanced Security for this repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class AdvancedSecurityRequest
|
||||
{
|
||||
public AdvancedSecurityRequest()
|
||||
{ }
|
||||
|
||||
public AdvancedSecurityRequest(Status? status)
|
||||
{
|
||||
this.Status = status;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Can be enabled, disabled, or null
|
||||
/// </summary>
|
||||
public Status? Status { get; set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the status property to enable or disable Dependabot security updates for this repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class DependabotSecurityUpdatesRequest
|
||||
{
|
||||
public DependabotSecurityUpdatesRequest()
|
||||
{ }
|
||||
|
||||
public DependabotSecurityUpdatesRequest(Status? status)
|
||||
{
|
||||
this.Status = status;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Can be enabled, disabled, or null
|
||||
/// </summary>
|
||||
public Status? Status { get; set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the status property to enable or disable secret scanning for this repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class SecretScanningRequest
|
||||
{
|
||||
public SecretScanningRequest()
|
||||
{ }
|
||||
|
||||
public SecretScanningRequest(Status? status)
|
||||
{
|
||||
this.Status = status;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Can be enabled, disabled, or null
|
||||
/// </summary>
|
||||
public Status? Status { get; set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the status property to enable or disable secret scanning push protection for this repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class SecretScanningPushProtectionRequest
|
||||
{
|
||||
public SecretScanningPushProtectionRequest()
|
||||
{ }
|
||||
|
||||
public SecretScanningPushProtectionRequest(Status? status)
|
||||
{
|
||||
this.Status = status;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Can be enabled, disabled, or null
|
||||
/// </summary>
|
||||
public Status? Status { get; set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the status property to enable or disable secret scanning validity checks for this repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class SecretScanningValidityChecksRequest
|
||||
{
|
||||
public SecretScanningValidityChecksRequest()
|
||||
{ }
|
||||
|
||||
public SecretScanningValidityChecksRequest(Status? status)
|
||||
{
|
||||
this.Status = status;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Can be enabled, disabled, or null
|
||||
/// </summary>
|
||||
public Status? Status { get; set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
@@ -17,7 +16,7 @@ namespace Octokit
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public Repository(string url, string htmlUrl, string cloneUrl, string gitUrl, string sshUrl, string svnUrl, string mirrorUrl, string archiveUrl, long id, string nodeId, User owner, string name, string fullName, bool isTemplate, string description, string homepage, string language, bool @private, bool fork, int forksCount, int stargazersCount, string defaultBranch, int openIssuesCount, DateTimeOffset? pushedAt, DateTimeOffset createdAt, DateTimeOffset updatedAt, RepositoryPermissions permissions, Repository parent, Repository source, LicenseMetadata license, bool hasDiscussions, bool hasIssues, bool hasWiki, bool hasDownloads, bool hasPages, int subscribersCount, long size, bool? allowRebaseMerge, bool? allowSquashMerge, bool? allowMergeCommit, bool archived, int watchersCount, bool? deleteBranchOnMerge, RepositoryVisibility visibility, IEnumerable<string> topics, bool? allowAutoMerge, bool? allowUpdateBranch, bool? webCommitSignoffRequired, IReadOnlyDictionary<string, object> customProperties)
|
||||
public Repository(string url, string htmlUrl, string cloneUrl, string gitUrl, string sshUrl, string svnUrl, string mirrorUrl, string archiveUrl, long id, string nodeId, User owner, string name, string fullName, bool isTemplate, string description, string homepage, string language, bool @private, bool fork, int forksCount, int stargazersCount, string defaultBranch, int openIssuesCount, DateTimeOffset? pushedAt, DateTimeOffset createdAt, DateTimeOffset updatedAt, RepositoryPermissions permissions, Repository parent, Repository source, LicenseMetadata license, bool hasDiscussions, bool hasIssues, bool hasWiki, bool hasDownloads, bool hasPages, int subscribersCount, long size, bool? allowRebaseMerge, bool? allowSquashMerge, bool? allowMergeCommit, bool archived, int watchersCount, bool? deleteBranchOnMerge, RepositoryVisibility visibility, IEnumerable<string> topics, bool? allowAutoMerge, bool? allowUpdateBranch, bool? webCommitSignoffRequired, SecurityAndAnalysis securityAndAnalysis)
|
||||
{
|
||||
Url = url;
|
||||
HtmlUrl = htmlUrl;
|
||||
@@ -69,7 +68,7 @@ namespace Octokit
|
||||
AllowAutoMerge = allowAutoMerge;
|
||||
AllowUpdateBranch = allowUpdateBranch;
|
||||
WebCommitSignoffRequired = webCommitSignoffRequired;
|
||||
CustomProperties = customProperties;
|
||||
SecurityAndAnalysis = securityAndAnalysis;
|
||||
}
|
||||
|
||||
public string Url { get; private set; }
|
||||
@@ -171,7 +170,7 @@ namespace Octokit
|
||||
|
||||
public bool? WebCommitSignoffRequired { get; private set; }
|
||||
|
||||
public IReadOnlyDictionary<string, object> CustomProperties { get; private set; }
|
||||
public SecurityAndAnalysis SecurityAndAnalysis { get; private set;}
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
|
||||
177
Octokit/Models/Response/SecurityAndAnalysis.cs
Normal file
177
Octokit/Models/Response/SecurityAndAnalysis.cs
Normal file
@@ -0,0 +1,177 @@
|
||||
using Octokit.Internal;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// The security and analysis features that are enabled or disabled for the repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class SecurityAndAnalysis
|
||||
{
|
||||
public SecurityAndAnalysis()
|
||||
{ }
|
||||
|
||||
public SecurityAndAnalysis(AdvancedSecurity advancedSecurity, DependabotSecurityUpdates dependabotSecurityUpdates, SecretScanning secretScanning, SecretScanningPushProtection secretScanningPushProtection, SecretScanningValidityChecks secretScanningValidityChecks)
|
||||
{
|
||||
this.AdvancedSecurity = advancedSecurity;
|
||||
this.DependabotSecurityUpdates = dependabotSecurityUpdates;
|
||||
this.SecretScanning = secretScanning;
|
||||
this.SecretScanningPushProtection = secretScanningPushProtection;
|
||||
this.SecretScanningValidityChecks = secretScanningValidityChecks;
|
||||
}
|
||||
|
||||
|
||||
public AdvancedSecurity AdvancedSecurity { get; protected set; }
|
||||
|
||||
public DependabotSecurityUpdates DependabotSecurityUpdates { get; protected set; }
|
||||
|
||||
public SecretScanning SecretScanning { get; protected set; }
|
||||
|
||||
public SecretScanningPushProtection SecretScanningPushProtection { get; protected set; }
|
||||
|
||||
public SecretScanningValidityChecks SecretScanningValidityChecks { get; protected set; }
|
||||
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Use the status property to enable or disable GitHub Advanced Security for this repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class AdvancedSecurity
|
||||
{
|
||||
public AdvancedSecurity()
|
||||
{ }
|
||||
|
||||
public AdvancedSecurity(string status)
|
||||
{
|
||||
this.Status = status;
|
||||
}
|
||||
|
||||
|
||||
public string Status { get; protected set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the status property to enable or disable Dependabot security updates for this repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class DependabotSecurityUpdates
|
||||
{
|
||||
public DependabotSecurityUpdates()
|
||||
{ }
|
||||
|
||||
public DependabotSecurityUpdates(string status)
|
||||
{
|
||||
this.Status = status;
|
||||
}
|
||||
|
||||
|
||||
public string Status { get; protected set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the status property to enable or disable secret scanning for this repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class SecretScanning
|
||||
{
|
||||
public SecretScanning()
|
||||
{ }
|
||||
|
||||
public SecretScanning(string status)
|
||||
{
|
||||
this.Status = status;
|
||||
}
|
||||
|
||||
|
||||
public string Status { get; protected set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the status property to enable or disable secret scanning push protection for this repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class SecretScanningPushProtection
|
||||
{
|
||||
public SecretScanningPushProtection()
|
||||
{ }
|
||||
|
||||
public SecretScanningPushProtection(string status)
|
||||
{
|
||||
this.Status = status;
|
||||
}
|
||||
|
||||
|
||||
public string Status { get; protected set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the status property to enable or disable secret scanning validity checks for this repository
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class SecretScanningValidityChecks
|
||||
{
|
||||
public SecretScanningValidityChecks()
|
||||
{ }
|
||||
|
||||
public SecretScanningValidityChecks(string status)
|
||||
{
|
||||
this.Status = status;
|
||||
}
|
||||
|
||||
|
||||
public string Status { get; protected set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SimpleJsonSerializer().Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user