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()
|
|
|
|
{
|
2021-04-23 13:19:47 -04:00
|
|
|
switch (storageType(storageRepo()))
|
2020-07-02 16:24:34 -04:00
|
|
|
{
|
2021-04-23 13:19:47 -04:00
|
|
|
case STORAGE_AZURE_TYPE:
|
2022-04-09 18:29:57 -04:00
|
|
|
{
|
|
|
|
storageAzureRequestP(
|
|
|
|
(StorageAzure *)storageDriver(storageRepoWrite()), HTTP_VERB_PUT_STR,
|
|
|
|
.query = httpQueryAdd(httpQueryNewP(), AZURE_QUERY_RESTYPE_STR, AZURE_QUERY_VALUE_CONTAINER_STR));
|
|
|
|
|
2021-04-23 13:19:47 -04:00
|
|
|
break;
|
2022-04-09 18:29:57 -04:00
|
|
|
}
|
2021-04-23 13:19:47 -04:00
|
|
|
|
|
|
|
case STORAGE_GCS_TYPE:
|
2022-04-09 18:29:57 -04:00
|
|
|
{
|
|
|
|
storageGcsRequestP(
|
|
|
|
(StorageGcs *)storageDriver(storageRepoWrite()), HTTP_VERB_POST_STR, .noBucket = true,
|
2022-04-25 09:06:26 -04:00
|
|
|
.content = BUFSTR(
|
|
|
|
jsonWriteResult(
|
|
|
|
jsonWriteObjectEnd(
|
|
|
|
jsonWriteStr(
|
|
|
|
jsonWriteKeyZ(
|
|
|
|
jsonWriteObjectBegin(
|
|
|
|
jsonWriteNewP()), GCS_JSON_NAME), cfgOptionStr(cfgOptRepoGcsBucket))))));
|
2021-04-23 13:19:47 -04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case STORAGE_S3_TYPE:
|
|
|
|
storageS3RequestP((StorageS3 *)storageDriver(storageRepoWrite()), HTTP_VERB_PUT_STR, FSLASH_STR);
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Other storage types do not require the repo to be created
|
|
|
|
default:
|
|
|
|
break;
|
2021-03-05 12:13:51 -05:00
|
|
|
}
|
2020-03-09 17:15:03 -04:00
|
|
|
}
|
|
|
|
MEM_CONTEXT_TEMP_END();
|
|
|
|
|
|
|
|
FUNCTION_LOG_RETURN_VOID();
|
|
|
|
}
|