本文整理汇总了C#中VVRestApi.Vault.VaultApi类的典型用法代码示例。如果您正苦于以下问题:C# VaultApi类的具体用法?C# VaultApi怎么用?C# VaultApi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VaultApi类属于VVRestApi.Vault命名空间,在下文中一共展示了VaultApi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVaultUserWebLoginToken
public ApiResponse GetVaultUserWebLoginToken(string userName, string apiKey, string developerSecret, string oAuthServerTokenEndPoint, string baseVaultUrl, string apiVersion, string customerAlias, string databaseAlias)
{
ApiResponse response = new ApiResponse();
try
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = apiKey,
ApiSecret = developerSecret,
OAuthTokenEndPoint = oAuthServerTokenEndPoint,
BaseUrl = baseVaultUrl,
ApiVersion = apiVersion,
CustomerAlias = customerAlias,
DatabaseAlias = databaseAlias
};
VaultApi vaultApi = new VaultApi(clientSecrets);
var user = vaultApi.Users.GetUser(userName);
if (user != null)
{
response.Value = user.GetWebLoginToken();
}
}
catch (Exception ex)
{
response.IsError = true;
response.ErrorMessage = ex.Message;
}
return response;
}
示例2: StorePersistedData
public ApiResponse StorePersistedData(string valuesInJsonFormat, int minutesToStoreData, string apiKey, string developerSecret, string oAuthServerTokenEndPoint, string baseVaultUrl, string apiVersion, string customerAlias, string databaseAlias)
{
ApiResponse response = new ApiResponse();
try
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = apiKey,
ApiSecret = developerSecret,
OAuthTokenEndPoint = oAuthServerTokenEndPoint,
BaseUrl = baseVaultUrl,
ApiVersion = apiVersion,
CustomerAlias = customerAlias,
DatabaseAlias = databaseAlias
};
VaultApi vaultApi = new VaultApi(clientSecrets);
DateTime expirationDate = DateTime.UtcNow.AddMinutes(minutesToStoreData);
var data = vaultApi.PersistedData.CreateData(Guid.NewGuid().ToString(), ScopeType.Global, valuesInJsonFormat, "text/JSON", string.Empty, LinkedObjectType.None, expirationDate);
if (data != null)
{
response.Value = data.Id.ToString();
}
}
catch (Exception ex)
{
response.IsError = true;
response.ErrorMessage = ex.Message;
}
return response;
}
示例3: AddSecurityMemberOnFolder
public void AddSecurityMemberOnFolder()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var generalFolder = vaultApi.Folders.GetFolderByPath("/General");
Assert.AreNotEqual(Guid.Empty, generalFolder.Id);
if (generalFolder != null)
{
var memberId = new Guid("22BF8B4C-A961-E111-8E23-14FEB5F06078");
var memberType = MemberType.Group;
var role = RoleType.Editor;
var updateCount = vaultApi.Folders.AddSecurityMember(generalFolder.Id, memberId, memberType, role);
Assert.AreEqual(1, updateCount);
}
}
示例4: GetCustomerDatabaseInfo
public void GetCustomerDatabaseInfo()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var dbInfo = vaultApi.Customer.GetCustomerDatabaseInfo();
Assert.IsNotNull(dbInfo);
}
示例5: GetApiObjectFieldNames
public void GetApiObjectFieldNames()
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
VaultApi vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
List<MetaDataType> ApiObjectTypes = vaultApi.Meta.GetDataTypes();
StringBuilder sbFieldList = new StringBuilder();
sbFieldList.AppendLine("API Object Field List");
foreach (MetaDataType apiObjectType in ApiObjectTypes)
{
sbFieldList.AppendLine("-----------------------------------------------------------------");
sbFieldList.AppendLine(string.Format("{0} fields: {1}", apiObjectType.Name, Environment.NewLine));
foreach (string fieldName in apiObjectType.AvailableFields)
{
sbFieldList.AppendLine(string.Format("{0}", fieldName));
}
}
LogEventManager.Info(sbFieldList.ToString());
}
示例6: FormTemplatesTest
public void FormTemplatesTest()
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
VaultApi vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
Page<FormTemplate> formTemplates = vaultApi.FormTemplates.GetFormTemplates();
foreach (FormTemplate formTemplate in formTemplates.Items)
{
Assert.IsNotNullOrEmpty(formTemplate.Name);
Debug.WriteLine("Form template name: " + formTemplate.Name);
}
Assert.IsTrue(formTemplates.Items.Count > 0);
}
示例7: FormDataTest
public void FormDataTest()
{
ClientSecrets clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
VaultApi vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var formTemplateId = new Guid("F9CB9977-5B0E-E211-80A1-14FEB5F06078");
//var options = new RequestOptions
//{
// Fields = "dhdocid,revisionid,City,First Name,Unit"
//};
var options = new RequestOptions
{
Query = "[VVModifyDate] ge '2015-11-07T22:18:09.444Z'",
Expand = true
};
var formdata = vaultApi.FormTemplates.GetFormInstanceData(formTemplateId, options);
Assert.IsNotNull(formdata);
//foreach (FormTemplate formTemplate in formTemplates.Items)
//{
// Assert.IsNotNullOrEmpty(formTemplate.Name);
//}
//Assert.IsNotNull(formTemplates);
}
示例8: CreateUsersTopLevelContainerFolder
public void CreateUsersTopLevelContainerFolder()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var folderName = "Irish Marshes";
var folderDescription = "The Green Irish Marshes";
var allowRevisions = true;
var namingConventionPrefix = "IrishMarshes-";
var namingConventionSufix = " - IM";
var datePosition = DocDatePosition.NoDateInsert;
var docSeqType = VVRestApi.Vault.Library.DocSeqType.TypeInteger;
var expireAction = ExpireAction.Nothing;
var expireRequired = false;
var expirationDays = 0;
var reviewRequired = false;
var reviewDays = 0;
var folder = vaultApi.Folders.CreateUsersTopLevelContainerFolder();
Assert.IsNotNull(folder);
}
示例9: UploadZeroByteFile
public void UploadZeroByteFile()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var folder = vaultApi.Folders.GetFolderByPath("/Test");
Assert.NotNull(folder);
if (folder != null)
{
var document = vaultApi.Documents.CreateDocument(folder.Id, "12345.txt", "Zero Byte Upload", "1", DocumentState.Released);
Assert.IsNotNull(document);
var fileArray = new byte[0];
var returnObject = vaultApi.Files.UploadZeroByteFile(document.DocumentId, "12345.txt", 5, fileArray);
}
}
示例10: UploadFileStream
public void UploadFileStream()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
//var testFolder = vaultApi.Folders.GetFolderByPath("/Arbys");
//if (testFolder != null)
//{
var document = vaultApi.Documents.CreateDocument(new Guid("C9B9DB43-5BCF-E411-8281-14FEB5F06078"), "RandomNewDocument", "Random New Document in TestFolder", "1", DocumentState.Released);
Assert.IsNotNull(document);
var documentId = document.DocumentId;
//documentId = Guid.Empty;
var fileStream = TestHelperShared.GetSearchWordTextFileStream();
//var byteArray = TestHelperShared.GetSearchWordTextFile();
//var fileStream = TestHelperShared.GetFileStream(@"c:\temp\video1.mp4");
//if (fileStream == null)
//{
// throw new Exception("Could not get the embedded file: SearchWordTextFile.txt");
//}
var indexFields = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("Name", "Test Data")
};
var optParameters = new JObject(){
new JProperty("source", "DocumentViewer"),
new JProperty("command", "copyPriorRevisionAnnotations")
};
var returnObject = vaultApi.Files.UploadFile(documentId, "SearchWordTextFile.txt", "14", "14", DocumentCheckInState.Released, indexFields, fileStream, optParameters);
var meta = returnObject.GetValue("meta") as JObject;
if (meta != null)
{
var status = meta.GetValue("status").Value<string>();
Assert.AreEqual("200", status);
var checkinstatusString = meta.GetValue("checkInStatus").Value<string>();
Assert.AreEqual(CheckInStatusType.CheckedIn.ToString(), checkinstatusString);
}
//}
}
示例11: UploadFile
public void UploadFile()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
//var arbysFolder = vaultApi.Folders.GetFolderByPath("/Arbys");
//if (arbysFolder != null)
//{
var document = vaultApi.Documents.CreateDocument(new Guid("C9B9DB43-5BCF-E411-8281-14FEB5F06078"), "SeventhNewDocument", "Seventh New Document in Arbys", "1", DocumentState.Released);
Assert.IsNotNull(document);
var fileArray = TestHelperShared.GetSearchWordTextFile();
//var returnObject = vaultApi.Files.UploadFile(document.DocumentId, "SearchWordTextFile", fileArray);
//}
}
示例12: UpdateIndexFieldsForDocument
public void UpdateIndexFieldsForDocument()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var dlId = new Guid("85fa0e91-a64a-e511-82a3-5cf3706c36ed");
//var dhId = new Guid("BD9DB6B5-A64A-E511-82A3-5CF3706C36ED");
//var dataId = new Guid("5ABEAFB5-A64A-E511-82A3-5CF3706C36ED");
var indexFields = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("name", "Some common name"),
new KeyValuePair<string, string>("text1", "Appropriate text goes here"),
};
var docIndexFields = vaultApi.Documents.UpdateIndexFieldValues(dlId, indexFields);
Assert.IsNotEmpty(docIndexFields);
}
示例13: UpdateIndexFieldForDocument
public void UpdateIndexFieldForDocument()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var dlId = new Guid("85fa0e91-a64a-e511-82a3-5cf3706c36ed");
var dhId = new Guid("BD9DB6B5-A64A-E511-82A3-5CF3706C36ED");
var fieldId = new Guid("3AD6D13A-2E75-E111-84E2-14FEB5F06078");
var dataId = new Guid("5ABEAFB5-A64A-E511-82A3-5CF3706C36ED");
var value = "Movies";
var docIndexField = vaultApi.Documents.UpdateIndexFieldValue(dlId, fieldId, value);
Assert.AreEqual(value, docIndexField.Value);
}
示例14: UpdateGroupDescription
public void UpdateGroupDescription()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var groupId = new Guid("B0B428D4-4183-E511-82B0-5CF3706C36ED");
var newDescription = "New Group Desciption";
var group = vaultApi.Groups.UpdateGroupDescription(groupId, newDescription);
Assert.IsNotNull(group);
}
示例15: ShareDocumentWithUsers
public void ShareDocumentWithUsers()
{
var clientSecrets = new ClientSecrets
{
ApiKey = RestApiTests.ClientId,
ApiSecret = RestApiTests.ClientSecret,
OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint,
BaseUrl = RestApiTests.VaultApiBaseUrl,
ApiVersion = RestApiTests.ApiVersion,
CustomerAlias = RestApiTests.CustomerAlias,
DatabaseAlias = RestApiTests.DatabaseAlias,
Scope = RestApiTests.Scope
};
var vaultApi = new VaultApi(clientSecrets);
Assert.IsNotNull(vaultApi);
var dlId = new Guid("6ADC119D-C6A8-E411-8278-14FEB5F06078");
var userWopUsId = new Guid("369493C9-36AD-E211-9D53-14FEB5F06078");
var userWpUsId = new Guid("A6DFFCC3-35AD-E211-9D53-14FEB5F06078");
var aceAdmin = new Guid("ABD2F88A-8861-E111-8E23-14FEB5F06078");
var userList = new List<Guid>
{
userWopUsId,
userWpUsId,
aceAdmin
};
//var document = vaultApi.Documents.GetDocument(dlId, new RequestOptions { Fields = "Id,DhId,FieldId,FieldType,Label,Required,Value,OrdinalPosition,CreateDate,CreateById,CreateBy,ModifyDate,ModifyBy,ModifyById" });
var documentShare = vaultApi.DocumentShares.ShareDocument(dlId, userList);
Assert.IsNotEmpty(documentShare);
}