-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for access keys management in Account Provisioning API
- Loading branch information
1 parent
e1dc7f9
commit 91b770c
Showing
10 changed files
with
538 additions
and
6 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
namespace CloudinaryDotNet.Actions | ||
{ | ||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
/// <summary> | ||
/// A single access key. | ||
/// </summary> | ||
[DataContract] | ||
public class AccessKeyResult : BaseResult | ||
{ | ||
/// <summary> | ||
/// Gets or sets name of the access key. | ||
/// </summary> | ||
[DataMember(Name = "name")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets API key. | ||
/// </summary> | ||
[DataMember(Name = "api_key")] | ||
public string ApiKey { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the API secret. | ||
/// </summary> | ||
[DataMember(Name = "api_secret")] | ||
public string ApiSecret { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets date when the key was created. | ||
/// </summary> | ||
[DataMember(Name = "created_at")] | ||
public DateTime CreatedAt { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets date when the key was updated. | ||
/// </summary> | ||
[DataMember(Name = "updated_at")] | ||
public DateTime UpdatedAt { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether access key is enabled or not. | ||
/// </summary> | ||
[DataMember(Name = "enabled")] | ||
public bool Enabled { get; set; } | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
CloudinaryDotNet/Provisioning/Actions/GenerateAccessKeyParams.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,60 @@ | ||
namespace CloudinaryDotNet.Actions | ||
{ | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
/// <summary> | ||
/// Parameters of generate access key request. | ||
/// </summary> | ||
public class GenerateAccessKeyParams : BaseParams | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="GenerateAccessKeyParams"/> class. | ||
/// </summary> | ||
/// <param name="subAccountId">The ID of the sub-account.</param> | ||
public GenerateAccessKeyParams(string subAccountId) | ||
{ | ||
SubAccountId = subAccountId; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the ID of the sub-account. | ||
/// </summary> | ||
public string SubAccountId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the name of the access key. | ||
/// </summary> | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets whether the access key is enabled. | ||
/// </summary> | ||
public bool? Enabled { get; set; } | ||
|
||
/// <summary> | ||
/// Validate object model. | ||
/// </summary> | ||
public override void Check() | ||
{ | ||
Utils.ShouldNotBeEmpty(() => SubAccountId); | ||
} | ||
|
||
/// <summary> | ||
/// Add parameters to the object model dictionary. | ||
/// </summary> | ||
/// <param name="dict">Dictionary to be updated with parameters.</param> | ||
protected override void AddParamsToDictionary(SortedDictionary<string, object> dict) | ||
{ | ||
if (!string.IsNullOrEmpty(Name)) | ||
{ | ||
AddParam(dict, "name", Name); | ||
} | ||
|
||
if (Enabled.HasValue) | ||
{ | ||
AddParam(dict, "enabled", Enabled); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.