2020-03-09 17:15:03 -04:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Repository Create Command
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
#include "build.auto.h"
|
|
|
|
|
|
|
|
#include "common/debug.h"
|
|
|
|
#include "common/log.h"
|
|
|
|
#include "common/memContext.h"
|
2021-03-05 12:13:51 -05:00
|
|
|
#include "common/type/json.h"
|
2020-03-09 17:15:03 -04:00
|
|
|
#include "config/config.h"
|
|
|
|
#include "storage/helper.h"
|
2020-07-02 16:24:34 -04:00
|
|
|
#include "storage/azure/storage.intern.h"
|
2021-03-05 12:13:51 -05:00
|
|
|
#include "storage/gcs/storage.intern.h"
|
2020-03-09 17:15:03 -04:00
|
|
|
#include "storage/s3/storage.intern.h"
|
|
|
|
|
|
|
|
/**********************************************************************************************************************************/
|
|
|
|
void
|
|
|
|
cmdRepoCreate(void)
|
|
|
|
{
|
|
|
|
FUNCTION_LOG_VOID(logLevelDebug);
|
|
|
|
|
|
|
|
MEM_CONTEXT_TEMP_BEGIN()
|
|
|
|
{
|
|
|
|
if (strEq(storageType(storageRepo()), STORAGE_S3_TYPE_STR))
|
2020-07-02 16:24:34 -04:00
|
|
|
{
|
2020-06-24 13:44:00 -04:00
|
|
|
storageS3RequestP((StorageS3 *)storageDriver(storageRepoWrite()), HTTP_VERB_PUT_STR, FSLASH_STR);
|
2020-07-02 16:24:34 -04:00
|
|
|
}
|
|
|
|
else if (strEq(storageType(storageRepo()), STORAGE_AZURE_TYPE_STR))
|
|
|
|
{
|
|
|
|
storageAzureRequestP(
|
|
|
|
(StorageAzure *)storageDriver(storageRepoWrite()), HTTP_VERB_PUT_STR,
|
2020-07-14 13:09:48 -04:00
|
|
|
.query = httpQueryAdd(httpQueryNewP(), AZURE_QUERY_RESTYPE_STR, AZURE_QUERY_VALUE_CONTAINER_STR));
|
2020-07-02 16:24:34 -04:00
|
|
|
}
|
2021-03-05 12:13:51 -05:00
|
|
|
else if (strEq(storageType(storageRepo()), STORAGE_GCS_TYPE_STR))
|
|
|
|
{
|
|
|
|
KeyValue *kvContent = kvPut(kvNew(), GCS_JSON_NAME_VAR, VARSTR(cfgOptionStr(cfgOptRepoGcsBucket)));
|
|
|
|
|
|
|
|
storageGcsRequestP(
|
|
|
|
(StorageGcs *)storageDriver(storageRepoWrite()), HTTP_VERB_POST_STR, .noBucket = true,
|
|
|
|
.content = BUFSTR(jsonFromKv(kvContent)));
|
|
|
|
}
|
2020-03-09 17:15:03 -04:00
|
|
|
}
|
|
|
|
MEM_CONTEXT_TEMP_END();
|
|
|
|
|
|
|
|
FUNCTION_LOG_RETURN_VOID();
|
|
|
|
}
|