github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/fgs/v2/function/urls.go (about)

     1  package function
     2  
     3  import "github.com/huaweicloud/golangsdk"
     4  
     5  const (
     6  	FGS      = "fgs"
     7  	FUNCTION = "functions"
     8  	CODE     = "code"
     9  	CONFIG   = "config"
    10  	VERSION  = "versions"
    11  	ALIAS    = "aliases"
    12  	INVOKE   = "invocations"
    13  	ASINVOKE = "invocations-async"
    14  )
    15  
    16  func createURL(c *golangsdk.ServiceClient) string {
    17  	return listURL(c)
    18  }
    19  
    20  func listURL(c *golangsdk.ServiceClient) string {
    21  	return c.ServiceURL(FGS, FUNCTION)
    22  }
    23  
    24  func deleteURL(c *golangsdk.ServiceClient, functionUrn string) string {
    25  	return c.ServiceURL(FGS, FUNCTION, functionUrn)
    26  }
    27  
    28  //function code
    29  func getCodeURL(c *golangsdk.ServiceClient, functionUrn string) string {
    30  	return c.ServiceURL(FGS, FUNCTION, functionUrn, CODE)
    31  }
    32  
    33  func updateCodeURL(c *golangsdk.ServiceClient, functionUrn string) string {
    34  	return getCodeURL(c, functionUrn)
    35  }
    36  
    37  //function metadata
    38  func getMetadataURL(c *golangsdk.ServiceClient, functionUrn string) string {
    39  	return c.ServiceURL(FGS, FUNCTION, functionUrn, CONFIG)
    40  }
    41  
    42  func updateMetadataURL(c *golangsdk.ServiceClient, functionUrn string) string {
    43  	return getMetadataURL(c, functionUrn)
    44  }
    45  
    46  //function invoke
    47  func invokeURL(c *golangsdk.ServiceClient, functionUrn string) string {
    48  	return c.ServiceURL(FGS, FUNCTION, functionUrn, INVOKE)
    49  }
    50  
    51  func asyncInvokeURL(c *golangsdk.ServiceClient, functionUrn string) string {
    52  	return c.ServiceURL(FGS, FUNCTION, functionUrn, ASINVOKE)
    53  }
    54  
    55  //function version
    56  func createVersionURL(c *golangsdk.ServiceClient, functionUrn string) string {
    57  	return c.ServiceURL(FGS, FUNCTION, functionUrn, VERSION)
    58  }
    59  
    60  func listVersionURL(c *golangsdk.ServiceClient, functionUrn string) string {
    61  	return createVersionURL(c, functionUrn)
    62  }
    63  
    64  //function alias
    65  func createAliasURL(c *golangsdk.ServiceClient, functionUrn string) string {
    66  	return c.ServiceURL(FGS, FUNCTION, functionUrn, ALIAS)
    67  }
    68  
    69  func updateAliasURL(c *golangsdk.ServiceClient, functionUrn, aliasName string) string {
    70  	return c.ServiceURL(FGS, FUNCTION, functionUrn, ALIAS, aliasName)
    71  }
    72  
    73  func deleteAliasURL(c *golangsdk.ServiceClient, functionUrn, aliasName string) string {
    74  	return updateAliasURL(c, functionUrn, aliasName)
    75  }
    76  
    77  func getAliasURL(c *golangsdk.ServiceClient, functionUrn, aliasName string) string {
    78  	return updateAliasURL(c, functionUrn, aliasName)
    79  }
    80  
    81  func listAliasURL(c *golangsdk.ServiceClient, functionUrn string) string {
    82  	return createAliasURL(c, functionUrn)
    83  }