mirror of
https://github.com/sasjs/core.git
synced 2026-01-08 01:50:05 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91983e0a91 | ||
|
|
7b72f0ac94 |
29
all.sas
29
all.sas
@@ -1316,13 +1316,23 @@ Usage:
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
%macro mf_trimstr(basestr,trimstr);
|
%macro mf_trimstr(basestr,trimstr);
|
||||||
%local trimlen trimval;
|
%local baselen trimlen trimval;
|
||||||
|
|
||||||
|
/* return if basestr is shorter than trimstr (or 0) */
|
||||||
|
%let baselen=%length(%superq(basestr));
|
||||||
%let trimlen=%length(%superq(trimstr));
|
%let trimlen=%length(%superq(trimstr));
|
||||||
|
%if &baselen < &trimlen or &baselen=0 %then %return;
|
||||||
|
|
||||||
|
/* obtain the characters from the end of basestr */
|
||||||
%let trimval=%qsubstr(%superq(basestr)
|
%let trimval=%qsubstr(%superq(basestr)
|
||||||
,%length(%superq(basestr))-&trimlen+1
|
,%length(%superq(basestr))-&trimlen+1
|
||||||
,&trimlen);
|
,&trimlen);
|
||||||
|
|
||||||
%if %superq(trimval)=%superq(trimstr) %then %do;
|
/* compare and if matching, chop it off! */
|
||||||
|
%if %superq(basestr)=%superq(trimstr) %then %do;
|
||||||
|
%return;
|
||||||
|
%end;
|
||||||
|
%else %if %superq(trimval)=%superq(trimstr) %then %do;
|
||||||
%qsubstr(%superq(basestr),1,%length(%superq(basestr))-&trimlen)
|
%qsubstr(%superq(basestr),1,%length(%superq(basestr))-&trimlen)
|
||||||
%end;
|
%end;
|
||||||
%else %do;
|
%else %do;
|
||||||
@@ -11000,8 +11010,8 @@ libname &libref1 clear;
|
|||||||
)
|
)
|
||||||
|
|
||||||
%mend;/**
|
%mend;/**
|
||||||
@file mv_getgroups.sas
|
@file mv_getclients.sas
|
||||||
@brief Creates a dataset with a list of viya groups
|
@brief Get a list of Viya Clients
|
||||||
@details First, be sure you have an access token (which requires an app token).
|
@details First, be sure you have an access token (which requires an app token).
|
||||||
|
|
||||||
Using the macros here:
|
Using the macros here:
|
||||||
@@ -11021,7 +11031,7 @@ libname &libref1 clear;
|
|||||||
|
|
||||||
Now we can run the macro!
|
Now we can run the macro!
|
||||||
|
|
||||||
%mv_getgroups()
|
%mv_getclients()
|
||||||
|
|
||||||
@param access_token_var= The global macro variable to contain the access token
|
@param access_token_var= The global macro variable to contain the access token
|
||||||
@param grant_type= valid values are "password" or "authorization_code" (unquoted).
|
@param grant_type= valid values are "password" or "authorization_code" (unquoted).
|
||||||
@@ -11855,7 +11865,7 @@ run;
|
|||||||
%end;
|
%end;
|
||||||
|
|
||||||
/* prepare url */
|
/* prepare url */
|
||||||
%if &grant_type=authorization_code %then %do;
|
%if %index(%superq(grant_type),authorization_code) %then %do;
|
||||||
data _null_;
|
data _null_;
|
||||||
if symexist('_baseurl') then do;
|
if symexist('_baseurl') then do;
|
||||||
url=symget('_baseurl');
|
url=symget('_baseurl');
|
||||||
@@ -11874,7 +11884,7 @@ run;
|
|||||||
%put CLIENT_SECRET=&client_secret;
|
%put CLIENT_SECRET=&client_secret;
|
||||||
%put GRANT_TYPE=&grant_type;
|
%put GRANT_TYPE=&grant_type;
|
||||||
%put;
|
%put;
|
||||||
%if &grant_type=authorization_code %then %do;
|
%if %index(%superq(grant_type),authorization_code) %then %do;
|
||||||
/* cannot use base_uri here as it includes the protocol which may be incorrect externally */
|
/* cannot use base_uri here as it includes the protocol which may be incorrect externally */
|
||||||
%put NOTE: The developer must also register below and select 'openid' to get the grant code:;
|
%put NOTE: The developer must also register below and select 'openid' to get the grant code:;
|
||||||
%put NOTE- ;
|
%put NOTE- ;
|
||||||
@@ -11941,6 +11951,7 @@ libname &libref clear;
|
|||||||
@param pass= If grant_type=password then provide the password here
|
@param pass= If grant_type=password then provide the password here
|
||||||
@param access_token_var= The global macro variable to contain the access token
|
@param access_token_var= The global macro variable to contain the access token
|
||||||
@param refresh_token_var= The global macro variable to contain the refresh token
|
@param refresh_token_var= The global macro variable to contain the refresh token
|
||||||
|
@param base_uri= The Viya API server location
|
||||||
|
|
||||||
@version VIYA V.03.04
|
@version VIYA V.03.04
|
||||||
@author Allan Bowe
|
@author Allan Bowe
|
||||||
@@ -11965,6 +11976,7 @@ libname &libref clear;
|
|||||||
,pass=
|
,pass=
|
||||||
,access_token_var=ACCESS_TOKEN
|
,access_token_var=ACCESS_TOKEN
|
||||||
,refresh_token_var=REFRESH_TOKEN
|
,refresh_token_var=REFRESH_TOKEN
|
||||||
|
,base_uri=#NOTSET#
|
||||||
);
|
);
|
||||||
%global &access_token_var &refresh_token_var;
|
%global &access_token_var &refresh_token_var;
|
||||||
|
|
||||||
@@ -12011,8 +12023,7 @@ run;
|
|||||||
/**
|
/**
|
||||||
* Request access token
|
* Request access token
|
||||||
*/
|
*/
|
||||||
%local base_uri; /* location of rest apis */
|
%if &base_uri=#NOTSET# %then %let base_uri=%mf_getplatform(VIYARESTAPI);
|
||||||
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
|
||||||
|
|
||||||
%let fref2=%mf_getuniquefileref();
|
%let fref2=%mf_getuniquefileref();
|
||||||
proc http method='POST' in=&grantstring out=&fref2
|
proc http method='POST' in=&grantstring out=&fref2
|
||||||
|
|||||||
@@ -23,13 +23,23 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
%macro mf_trimstr(basestr,trimstr);
|
%macro mf_trimstr(basestr,trimstr);
|
||||||
%local trimlen trimval;
|
%local baselen trimlen trimval;
|
||||||
|
|
||||||
|
/* return if basestr is shorter than trimstr (or 0) */
|
||||||
|
%let baselen=%length(%superq(basestr));
|
||||||
%let trimlen=%length(%superq(trimstr));
|
%let trimlen=%length(%superq(trimstr));
|
||||||
|
%if &baselen < &trimlen or &baselen=0 %then %return;
|
||||||
|
|
||||||
|
/* obtain the characters from the end of basestr */
|
||||||
%let trimval=%qsubstr(%superq(basestr)
|
%let trimval=%qsubstr(%superq(basestr)
|
||||||
,%length(%superq(basestr))-&trimlen+1
|
,%length(%superq(basestr))-&trimlen+1
|
||||||
,&trimlen);
|
,&trimlen);
|
||||||
|
|
||||||
%if %superq(trimval)=%superq(trimstr) %then %do;
|
/* compare and if matching, chop it off! */
|
||||||
|
%if %superq(basestr)=%superq(trimstr) %then %do;
|
||||||
|
%return;
|
||||||
|
%end;
|
||||||
|
%else %if %superq(trimval)=%superq(trimstr) %then %do;
|
||||||
%qsubstr(%superq(basestr),1,%length(%superq(basestr))-&trimlen)
|
%qsubstr(%superq(basestr),1,%length(%superq(basestr))-&trimlen)
|
||||||
%end;
|
%end;
|
||||||
%else %do;
|
%else %do;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
@file mv_getgroups.sas
|
@file mv_getclients.sas
|
||||||
@brief Creates a dataset with a list of viya groups
|
@brief Get a list of Viya Clients
|
||||||
@details First, be sure you have an access token (which requires an app token).
|
@details First, be sure you have an access token (which requires an app token).
|
||||||
|
|
||||||
Using the macros here:
|
Using the macros here:
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
Now we can run the macro!
|
Now we can run the macro!
|
||||||
|
|
||||||
%mv_getgroups()
|
%mv_getclients()
|
||||||
|
|
||||||
@param access_token_var= The global macro variable to contain the access token
|
@param access_token_var= The global macro variable to contain the access token
|
||||||
@param grant_type= valid values are "password" or "authorization_code" (unquoted).
|
@param grant_type= valid values are "password" or "authorization_code" (unquoted).
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ run;
|
|||||||
%end;
|
%end;
|
||||||
|
|
||||||
/* prepare url */
|
/* prepare url */
|
||||||
%if &grant_type=authorization_code %then %do;
|
%if %index(%superq(grant_type),authorization_code) %then %do;
|
||||||
data _null_;
|
data _null_;
|
||||||
if symexist('_baseurl') then do;
|
if symexist('_baseurl') then do;
|
||||||
url=symget('_baseurl');
|
url=symget('_baseurl');
|
||||||
@@ -206,7 +206,7 @@ run;
|
|||||||
%put CLIENT_SECRET=&client_secret;
|
%put CLIENT_SECRET=&client_secret;
|
||||||
%put GRANT_TYPE=&grant_type;
|
%put GRANT_TYPE=&grant_type;
|
||||||
%put;
|
%put;
|
||||||
%if &grant_type=authorization_code %then %do;
|
%if %index(%superq(grant_type),authorization_code) %then %do;
|
||||||
/* cannot use base_uri here as it includes the protocol which may be incorrect externally */
|
/* cannot use base_uri here as it includes the protocol which may be incorrect externally */
|
||||||
%put NOTE: The developer must also register below and select 'openid' to get the grant code:;
|
%put NOTE: The developer must also register below and select 'openid' to get the grant code:;
|
||||||
%put NOTE- ;
|
%put NOTE- ;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
@param pass= If grant_type=password then provide the password here
|
@param pass= If grant_type=password then provide the password here
|
||||||
@param access_token_var= The global macro variable to contain the access token
|
@param access_token_var= The global macro variable to contain the access token
|
||||||
@param refresh_token_var= The global macro variable to contain the refresh token
|
@param refresh_token_var= The global macro variable to contain the refresh token
|
||||||
|
@param base_uri= The Viya API server location
|
||||||
|
|
||||||
@version VIYA V.03.04
|
@version VIYA V.03.04
|
||||||
@author Allan Bowe
|
@author Allan Bowe
|
||||||
@@ -62,6 +63,7 @@
|
|||||||
,pass=
|
,pass=
|
||||||
,access_token_var=ACCESS_TOKEN
|
,access_token_var=ACCESS_TOKEN
|
||||||
,refresh_token_var=REFRESH_TOKEN
|
,refresh_token_var=REFRESH_TOKEN
|
||||||
|
,base_uri=#NOTSET#
|
||||||
);
|
);
|
||||||
%global &access_token_var &refresh_token_var;
|
%global &access_token_var &refresh_token_var;
|
||||||
|
|
||||||
@@ -108,8 +110,7 @@ run;
|
|||||||
/**
|
/**
|
||||||
* Request access token
|
* Request access token
|
||||||
*/
|
*/
|
||||||
%local base_uri; /* location of rest apis */
|
%if &base_uri=#NOTSET# %then %let base_uri=%mf_getplatform(VIYARESTAPI);
|
||||||
%let base_uri=%mf_getplatform(VIYARESTAPI);
|
|
||||||
|
|
||||||
%let fref2=%mf_getuniquefileref();
|
%let fref2=%mf_getuniquefileref();
|
||||||
proc http method='POST' in=&grantstring out=&fref2
|
proc http method='POST' in=&grantstring out=&fref2
|
||||||
|
|||||||
Reference in New Issue
Block a user