Skip to content

Commit

Permalink
rename sdk-user-agent to sdk-name
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Dec 24, 2024
1 parent a1df119 commit a27977a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ config.sh: configure config.mk
echo $(SED_ALIAS) >> config.sh
echo FUNCTION_SUFFIX=$(FUNCTION_SUFFIX) >> config.sh
echo "export CLI_NAME=$(CLI_NAME)" >> config.sh
echo "export SDK_USER_AGENT=$(SDK_USER_AGENT)" >> config.sh
echo "export SDK_NAME=$(SDK_NAME)" >> config.sh
echo "export FROM_PATH=$(FROM_PATH)" >> config.sh
echo -e "debug()\n{" >> config.sh
echo -e '\tif [[ "$$DEBUG_MODE" == "1" ]] ; then echo "$$@" >&2 ; fi\n}' >> config.sh
Expand Down
2 changes: 1 addition & 1 deletion cognac_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ EOF
done < function.${lang}
done
else
sed "s|____call_list____|${CALL_LIST}|g;s+____piped_call_list____+${PIPED_CALL_LIST}+;s/____api_version____/${API_VERSION}/g;s/____sdk_version____/${SDK_VERSION}/g;s/____cli_version____/$(cat cli-version)/g;s/____cli_name____/${CLI_NAME}/;s/____sdk_user_agent____/$SDK_USER_AGENT/g" <<< "$line"
sed "s|____call_list____|${CALL_LIST}|g;s+____piped_call_list____+${PIPED_CALL_LIST}+;s/____api_version____/${API_VERSION}/g;s/____sdk_version____/${SDK_VERSION}/g;s/____cli_version____/$(cat cli-version)/g;s/____cli_name____/${CLI_NAME}/;s/____sdk_name____/$SDK_NAME/g" <<< "$line"
fi
done < $1
}
Expand Down
10 changes: 5 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SDK_VERSION=0xC061AC
CLI_NAME=oapi-cli
FUNCTION_SUFFIX=Request
FROM_PATH=0
SDK_USER_AGENT='osc-sdk'
SDK_NAME='osc-sdk'
FUNCLIST_ARG=''
API_SCRIPT='curl -s https://raw.githubusercontent.com/outscale/osc-api/$(API_VERSION)/outscale.yaml | yq $(YQ_ARG) > osc-api.json'
DEBUG_MODE=0
Expand All @@ -33,7 +33,7 @@ for arg in $@; do
--wget-json-search wget json-search.Appimage
--gnu-sed-alias use gsed for sed
--cli-name=Name set cli name, default: oapi-cli
--sdk-user-agent=user-agent set sdk UserAgent, default: osc-sdk
--sdk-name=name set sdk Name, default: osc-sdk
--debug-mode enable debug in cognac (output on stderr)
--function-suffix=suffix suffix use to find function in componants, default: Request
--funclist-arg=arg arguments to pass to funclist
Expand Down Expand Up @@ -92,8 +92,8 @@ EOF
CLI_NAME=$( echo $arg | cut -f 2 -d '=' )
elif [ "--api-script" = $( echo "$arg" | cut -d '=' -f 1) ]; then
API_SCRIPT="$( echo ${!inc} | cut -f 2 -d '=' )"
elif [ "--sdk-user-agent" = $( echo "$arg" | cut -d '=' -f 1) ]; then
SDK_USER_AGENT="$( echo ${!inc} | cut -f 2 -d '=' )"
elif [ "--sdk-name" = $( echo "$arg" | cut -d '=' -f 1) ]; then
SDK_NAME="$( echo ${!inc} | cut -f 2 -d '=' )"
elif [ "--sdk-version" = $( echo "$arg" | cut -d '=' -f 1) ]; then
SDK_VERSION=$( echo $arg | cut -f 2 -d '=' )
elif [ "--curl-path" = $( echo "$arg" | cut -d '=' -f 1) ]; then
Expand Down Expand Up @@ -145,7 +145,7 @@ if [[ "$FUNCTION_SUFFIX" != "Request" && "$FUNCTION_SUFFIX" != "" ]]; then
FUNCLIST_ARG="--func-suffix $FUNCTION_SUFFIX $FUNCLIST_ARG"
fi

echo SDK_USER_AGENT=$SDK_USER_AGENT >> config.mk
echo SDK_NAME=$SDK_NAME >> config.mk
echo FUNCLIST_ARG=$FUNCLIST_ARG >> config.mk
echo DEBUG_MODE=$DEBUG_MODE >> config.mk
echo FROM_PATH=$FROM_PATH >> config.mk
Expand Down
4 changes: 2 additions & 2 deletions lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,14 +545,14 @@ int osc_init_sdk_ext(struct osc_env *e, const char *profile, unsigned int flag,
*e = (struct osc_env){0};
char *ca = getenv("CURL_CA_BUNDLE");
char *endpoint;
char user_agent[sizeof "____sdk_user_agent____-c/" + OSC_SDK_VERSON_L];
char user_agent[sizeof "____sdk_name____-c/" + OSC_SDK_VERSON_L];
char *cert = getenv("OSC_X509_CLIENT_CERT");
char *sslkey = getenv("OSC_X509_CLIENT_KEY");
char *auth = getenv("OSC_AUTH_METHOD");
char *force_log = cfg_login(cfg);
char *force_pass = cfg_pass(cfg);

strcpy(stpcpy(user_agent, "____sdk_user_agent____-c/"), osc_sdk_version_str());
strcpy(stpcpy(user_agent, "____sdk_name____-c/"), osc_sdk_version_str());
e->region = getenv("OSC_REGION");
e->flag = flag;
e->auth_method = cfg ? cfg->auth_method : OSC_AKSK_METHOD;
Expand Down
4 changes: 2 additions & 2 deletions main_tpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

#define OAPI_CLI_VERSION "____cli_version____"

#define OAPI_CLI_UAGENT "____cli_name____/"OAPI_CLI_VERSION"; ____sdk_user_agent____-c/"
#define OAPI_CLI_UAGENT "____cli_name____/"OAPI_CLI_VERSION"; ____sdk_name____-c/"

#define STRY(f, args...) \
do { \
Expand Down Expand Up @@ -296,7 +296,7 @@ int main(int ac, char **av)
flag |= OSC_INSECURE_MODE;
} else if (!strcmp("--version", av[i])) {
printf("%s version: %s\n"
"____sdk_user_agent____-c version: %s\n"
"____sdk_name____-c version: %s\n"
"based on osc-api: %s\n",
program_name,
OAPI_CLI_VERSION,
Expand Down

0 comments on commit a27977a

Please sign in to comment.