github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/apigw/v2/apis/requests.go (about)

     1  package apis
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  	"github.com/huaweicloud/golangsdk/pagination"
     6  )
     7  
     8  // APIOpts is a struct which will be used to create a new API or update an existing API.
     9  type APIOpts struct {
    10  	// ID of the API group to which the API belongs.
    11  	GroupId string `json:"group_id" required:"true"`
    12  	// API name, which can contain 3 to 64 characters, starting with a letter.
    13  	// Only letters, digits, and underscores (_) are allowed.
    14  	// Chinese characters must be in UTF-8 or Unicode format.
    15  	Name string `json:"name" required:"true"`
    16  	// API type. The valid types are as following:
    17  	//   1: public API
    18  	//   2: private API
    19  	Type int `json:"type" required:"true"`
    20  	// Request protocol. The valid protocols are as following:
    21  	//   HTTP.
    22  	//   HTTPS (default).
    23  	//   BOTH: The API can be accessed through both HTTP and HTTPS.
    24  	ReqProtocol string `json:"req_protocol" required:"true"`
    25  	// Request method. The valid values are GET,  POST,  PUT,  DELETE, HEAD, PATCH, OPTIONS and ANY.
    26  	ReqMethod string `json:"req_method" required:"true"`
    27  	// Request address, which can contain a maximum of 512 characters request parameters enclosed with brackets ({}).
    28  	// For example, /getUserInfo/{userId}.
    29  	// The request address can contain special characters, such as asterisks (), percent signs (%), hyphens (-), and
    30  	// underscores (_) and must comply with URI specifications.
    31  	// The address can contain environment variables, each starting with a letter and consisting of 3 to 32 characters.
    32  	// Only letters, digits, hyphens (-), and underscores (_) are allowed in environment variables.
    33  	ReqURI string `json:"req_uri" required:"true"`
    34  	// Security authentication mode. The valid modes are as following:
    35  	//   NONE
    36  	//   APP
    37  	//   IAM
    38  	//   AUTHORIZER
    39  	AuthType string `json:"auth_type" required:"true"`
    40  	// Backend type. The valid types are as following:
    41  	//   HTTP: web backend.
    42  	//   FUNCTION: FunctionGraph backend.
    43  	//   MOCK: Mock backend.
    44  	BackendType string `json:"backend_type" required:"true"`
    45  	// API version. The maximum length of version string is 16.
    46  	Version *string `json:"version,omitempty"`
    47  	// Security authentication parameter.
    48  	AuthOpt *AuthOpt `json:"auth_opt,omitempty"`
    49  	// Indicates whether CORS is supported. The valid values are as following:
    50  	//   TRUE: supported.
    51  	//   FALSE: not supported (default).
    52  	Cors *bool `json:"cors,omitempty"`
    53  	// Route matching mode.  The valid modes are as following:
    54  	//   SWA: prefix match
    55  	//   NORMAL: exact match (default).
    56  	MatchMode string `json:"match_mode,omitempty"`
    57  	// Description of the API, which can contain a maximum of 255 characters.
    58  	// Chinese characters must be in UTF-8 or Unicode format.
    59  	Description *string `json:"remark,omitempty"`
    60  	// API request body, which can be an example request body, media type, or parameters.
    61  	// Ensure that the request body does not exceed 20,480 characters.
    62  	// Chinese characters must be in UTF-8 or Unicode format.
    63  	BodyDescription *string `json:"body_remark,omitempty"`
    64  	// Example response for a successful request. Ensure that the response does not exceed 20,480 characters.
    65  	// Chinese characters must be in UTF-8 or Unicode format.
    66  	ResultNormalSample *string `json:"result_normal_sample,omitempty"`
    67  	// Example response for a failed request. Ensure that the response does not exceed 20,480 characters.
    68  	// Chinese characters must be in UTF-8 or Unicode format.
    69  	ResultFailureSample *string `json:"result_failure_sample,omitempty"`
    70  	// ID of the frontend custom authorizer.
    71  	AuthorizerId string `json:"authorizer_id,omitempty"`
    72  	// List of tags. The length of the tags list is range from 1 to 128.
    73  	// The value can contain only letters, digits, and underscores (_), and must start with a letter.
    74  	Tags []string `json:"tags,omitempty"`
    75  	// Group response ID.
    76  	ResponseId string `json:"response_id,omitempty"`
    77  	// Request parameters.
    78  	ReqParams []ReqParamBase `json:"req_params,omitempty"`
    79  	// Backend parameters.
    80  	BackendParams []BackendParamBase `json:"backend_params,omitempty"`
    81  	// Mock backend details.
    82  	MockInfo *Mock `json:"mock_info,omitempty"`
    83  	// FunctionGraph backend details.
    84  	FuncInfo *FuncGraph `json:"func_info,omitempty"`
    85  	// Web backend details.
    86  	WebInfo *Web `json:"backend_api,omitempty"`
    87  	// Mock policy backends.
    88  	PolicyMocks []PolicyMock `json:"policy_mocks,omitempty"`
    89  	// FunctionGraph policy backends.
    90  	PolicyFunctions []PolicyFuncGraph `json:"policy_functions,omitempty"`
    91  	// Web policy backends.
    92  	PolicyWebs []PolicyWeb `json:"policy_https,omitempty"`
    93  }
    94  
    95  // AuthOpt is an object which will be build up an APIG application authorization.
    96  type AuthOpt struct {
    97  	// Indicates whether AppCode authentication is enabled. The valid types are as following:
    98  	//   DISABLE: AppCode authentication is disabled (default).
    99  	//   HEADER: AppCode authentication is enabled and the AppCode is located in the header.
   100  	// This parameter is valid only if auth_type is set to App.
   101  	AppCodeAuthType string `json:"app_code_auth_type,omitempty"`
   102  }
   103  
   104  // Mock is an object which will be build up a mock backend.
   105  type Mock struct {
   106  	// Description about the backend, which can contain a maximum of 255 characters.
   107  	// Chinese characters must be in UTF-8 or Unicode format.
   108  	Description *string `json:"remark,omitempty"`
   109  	// Response.
   110  	ResultContent *string `json:"result_content,omitempty"`
   111  	// Function version Ensure that the version does not exceed 64 characters.
   112  	Version string `json:"version,omitempty"`
   113  	// Backend custom authorizer ID.
   114  	AuthorizerId *string `json:"authorizer_id,omitempty"`
   115  }
   116  
   117  // FuncGraph is an object which will be build up a function graph backend.
   118  type FuncGraph struct {
   119  	// Function URN.
   120  	FunctionUrn string `json:"function_urn" required:"true"`
   121  	// Invocation mode. The valid modes are as following:
   122  	//   async: asynchronous
   123  	//   sync: synchronous
   124  	InvocationType string `json:"invocation_type" required:"true"`
   125  	// Timeout, in ms, which allowed for API Gateway to request the backend service.
   126  	// The valid value is range from 1 to 600,000.
   127  	Timeout int `json:"timeout" required:"true"`
   128  	// Backend custom authorizer ID.
   129  	AuthorizerId *string `json:"authorizer_id,omitempty"`
   130  	// Description about the backend, which can contain a maximum of 255 characters.
   131  	// Chinese characters must be in UTF-8 or Unicode format.
   132  	Description *string `json:"remark,omitempty"`
   133  	// Function version.
   134  	// Maximum: 64
   135  	Version string `json:"version,omitempty"`
   136  }
   137  
   138  // Web is an object which will be build up a http backend.
   139  type Web struct {
   140  	// Request method. The valid methods are GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS and ANY.
   141  	ReqMethod string `json:"req_method" required:"true"`
   142  	// Request protocol. The valid protocols are HTTP and HTTPS
   143  	ReqProtocol string `json:"req_protocol" required:"true"`
   144  	// Request address, which can contain a maximum of 512 characters request parameters enclosed with brackets ({}).
   145  	// For example, /getUserInfo/{userId}.
   146  	// The request address can contain special characters, such as asterisks (*), percent signs (%), hyphens (-), and
   147  	// underscores (_) and must comply with URI specifications.
   148  	// The address can contain environment variables, each starting with a letter and consisting of 3 to 32 characters.
   149  	// Only letters, digits, hyphens (-), and underscores (_) are allowed in environment variables.
   150  	ReqURI string `json:"req_uri" required:"true"`
   151  	// Timeout, in ms, which allowed for API Gateway to request the backend service.
   152  	// The valid value is range from 1 to 600,000.
   153  	Timeout int `json:"timeout" required:"true"`
   154  	// Backend custom authorizer ID.
   155  	AuthorizerId *string `json:"authorizer_id,omitempty"`
   156  	// Backend service address which consists of a domain name or IP address and a port number, with not more than 255
   157  	// characters. It must be in the format "Host name:Port number", for example, apig.example.com:7443.
   158  	// If the port number is not specified, the default HTTPS port 443 or the default HTTP port 80 is used.
   159  	// The backend service address can contain environment variables, each starting with a letter and consisting of
   160  	// 3 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.
   161  	DomainURL string `json:"url_domain,omitempty"`
   162  	// Description, which can contain a maximum of 255 characters.
   163  	// Chinese characters must be in UTF-8 or Unicode format.
   164  	Description *string `json:"remark,omitempty"`
   165  	// Web backend version, which can contain a maximum of 16 characters.
   166  	Version *string `json:"version,omitempty"`
   167  	// Indicates whether to enable two-way authentication.
   168  	ClientSslEnable *bool `json:"enable_client_ssl,omitempty"`
   169  	// VPC channel details. This parameter is required if vpc_channel_status is set to 1.
   170  	VpcChannelInfo *VpcChannel `json:"vpc_channel_info,omitempty"`
   171  	// Indicates whether to use a VPC channel. The valid values are as following:
   172  	//   1: (A VPC channel is used).
   173  	//   2: (No VPC channel is used).
   174  	VpcChannelStatus int `json:"vpc_channel_status,omitempty"`
   175  }
   176  
   177  // VpcChannel is an object which will be build up a vpc channel.
   178  type VpcChannel struct {
   179  	// VPC channel ID.
   180  	VpcChannelId string `json:"vpc_channel_id" required:"true"`
   181  	// Proxy host.
   182  	VpcChannelProxyHost string `json:"vpc_channel_proxy_host,omitempty"`
   183  }
   184  
   185  // ReqParamBase is an object which will be build up a front-end request parameter.
   186  type ReqParamBase struct {
   187  	// The parameter name, which contain of 1 to 32 characters and start with a letter.
   188  	// Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.
   189  	Name string `json:"name" required:"true"`
   190  	// Parameter type. The valid types are as following:
   191  	//   STRING
   192  	//   NUMBER
   193  	Type string `json:"type" required:"true"`
   194  	// Parameter location. The valid modes are as following:
   195  	//   PATH
   196  	//   QUERY
   197  	//   HEADER
   198  	Location string `json:"location" required:"true"`
   199  	// Default value.
   200  	DefaultValue *string `json:"default_value,omitempty"`
   201  	// Example value.
   202  	SampleValue string `json:"sample_value,omitempty"`
   203  	// Indicates whether the parameter is required. The valid values are 1 (yes) and 2 (no).
   204  	// The value of this parameter is 1 if Location is set to PATH, and 2 if Location is set to another value.
   205  	Required int `json:"required,omitempty"`
   206  	// Indicates whether validity check is enabled. The valid modes are as following:
   207  	//   1: enabled.
   208  	//   2: disabled (default).
   209  	ValidEnable int `json:"valid_enable,omitempty"`
   210  	// Description about the backend, which can contain a maximum of 255 characters.
   211  	// Chinese characters must be in UTF-8 or Unicode format.
   212  	Description *string `json:"remark,omitempty"`
   213  	// Enumerated value.
   214  	Enumerations *string `json:"enumerations,omitempty"`
   215  	// Minimum value.
   216  	// This parameter is valid when type is set to NUMBER.
   217  	MinNum *int `json:"min_num,omitempty"`
   218  	// Maximum value.
   219  	// This parameter is valid when type is set to NUMBER.
   220  	MaxNum *int `json:"max_num,omitempty"`
   221  	// Minimum length.
   222  	// This parameter is valid when type is set to STRING.
   223  	MinSize *int `json:"min_size,omitempty"`
   224  	// Maximum length.
   225  	// This parameter is valid when type is set to STRING.
   226  	MaxSize *int `json:"max_size,omitempty"`
   227  	// Indicates whether to transparently transfer the parameter. The valid values are 1 (yes) and 2 (no).
   228  	PassThrough string `json:"pass_through,omitempty"`
   229  }
   230  
   231  // PolicyMock is an object which will be build up a backend policy of the mock.
   232  type PolicyMock struct {
   233  	// Policy conditions.
   234  	Conditions []APIConditionBase `json:"conditions" required:"true"`
   235  	// Effective mode of the backend policy. The valid modes are as following:
   236  	//   ALL: All conditions are met.
   237  	//   ANY: Any condition is met.
   238  	EffectMode string `json:"effect_mode" required:"true"`
   239  	// Backend name, which consists of 3 to 64 characters and must start with a letter and can contain letters, digits,
   240  	// and underscores (_).
   241  	Name string `json:"name" required:"true"`
   242  	// Authorizer ID.
   243  	AuthorizerId *string `json:"authorizer_id,omitempty"`
   244  	// Backend parameters.
   245  	BackendParams []BackendParamBase `json:"backend_params,omitempty"`
   246  	// Response.
   247  	ResultContent string `json:"result_content,omitempty"`
   248  }
   249  
   250  // PolicyFuncGraph is an object which will be build up a backend policy of the function graph.
   251  type PolicyFuncGraph struct {
   252  	// Policy conditions.
   253  	Conditions []APIConditionBase `json:"conditions" required:"true"`
   254  	// Effective mode of the backend policy.
   255  	//   ALL: All conditions are met.
   256  	//   ANY: Any condition is met.
   257  	EffectMode string `json:"effect_mode" required:"true"`
   258  	// Function URN.
   259  	FunctionUrn string `json:"function_urn" required:"true"`
   260  	// Invocation mode. The valid modes are as following:
   261  	//   async: asynchronous
   262  	//   sync: synchronous
   263  	InvocationType string `json:"invocation_type" required:"true"`
   264  	// The backend name consists of 3 to 64 characters, which must start with a letter and can contain letters, digits,
   265  	// and underscores (_).
   266  	Name string `json:"name" required:"true"`
   267  	// Authorizer ID.
   268  	AuthorizerId *string `json:"authorizer_id,omitempty"`
   269  	// Backend parameters.
   270  	BackendParams []BackendParamBase `json:"backend_params,omitempty"`
   271  	// Timeout, in ms, which allowed for API Gateway to request the backend service.
   272  	// The valid value is range from 1 to 600,000.
   273  	Timeout int `json:"timeout,omitempty"`
   274  	// Function version Ensure that the version does not exceed 64 characters.
   275  	Version string `json:"version,omitempty"`
   276  }
   277  
   278  // PolicyWeb is an object which will be build up a backend policy of the http.
   279  type PolicyWeb struct {
   280  	// Request protocol. The value can be HTTP or HTTPS.
   281  	ReqProtocol string `json:"req_protocol" required:"true"`
   282  	// Request method. The valid methods are GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS and ANY.
   283  	ReqMethod string `json:"req_method" required:"true"`
   284  	// Request address, which can contain request parameters enclosed with brackets ({}).
   285  	// For example, /getUserInfo/{userId}. The request address can contain special characters, such as asterisks (),
   286  	// percent signs (%), hyphens (-), and underscores (_). It can contain a maximum of 512 characters and must comply
   287  	// with URI specifications.
   288  	// The request address can contain environment variables, each starting with a letter and consisting of 3 to 32
   289  	// characters. Only letters, digits, hyphens (-), and underscores (_) are allowed in environment variables.
   290  	// The request address must comply with URI specifications.
   291  	ReqURI string `json:"req_uri" required:"true"`
   292  	// Effective mode of the backend policy. The valid modes are as following:
   293  	//   ALL: All conditions are met.
   294  	//   ANY: Any condition is met.
   295  	EffectMode string `json:"effect_mode" required:"true"`
   296  	// Backend name, which contains of 3 to 64, must start with a letter and can contain letters, digits, and
   297  	// underscores (_).
   298  	Name string `json:"name" required:"true"`
   299  	// Policy conditions.
   300  	Conditions []APIConditionBase `json:"conditions" required:"true"`
   301  	// Backend parameters.
   302  	BackendParams []BackendParamBase `json:"backend_params,omitempty"`
   303  	// Authorizer ID.
   304  	AuthorizerId *string `json:"authorizer_id,omitempty"`
   305  	// VPC channel details. This parameter is required if vpc_channel_status is set to 1.
   306  	VpcChannelInfo *VpcChannel `json:"vpc_channel_info,omitempty"`
   307  	// Indicates whether to use a VPC channel. The valid value are as following:
   308  	//   1: A VPC channel is used.
   309  	//   2: No VPC channel is used.
   310  	VpcChannelStatus int `json:"vpc_channel_status,omitempty"`
   311  	// Endpoint of the policy backend.
   312  	// An endpoint consists of a domain name or IP address and a port number, with not more than 255 characters.
   313  	// It must be in the format "Domain name:Port number", for example, apig.example.com:7443.
   314  	// If the port number is not specified, the default HTTPS port 443 or the default HTTP port 80 is used.
   315  	// The endpoint can contain environment variables, each starting with letter and consisting of 3 to 32 characters.
   316  	// Only letters, digits, hyphens (-), and underscores (_) are allowed.
   317  	DomainURL string `json:"url_domain,omitempty"`
   318  	// Timeout, in ms, which allowed for API Gateway to request the backend service.
   319  	// The valid value is range from 1 to 600,000.
   320  	Timeout int `json:"timeout,omitempty"`
   321  }
   322  
   323  // BackendParamBase is an object which will be build up a back-end parameter.
   324  type BackendParamBase struct {
   325  	// Parameter type. The valid types are as following:
   326  	//   REQUEST: Backend parameter.
   327  	//   CONSTANT: Constant parameter.
   328  	//   SYSTEM: System parameter.
   329  	Origin string `json:"origin" required:"true"`
   330  	// Parameter name, which can contains 1 to 32 characters, must start with a letter and can only contain letters,
   331  	// digits, hyphens (-), underscores (_) and periods (.).
   332  	Name string `json:"name" required:"true"`
   333  	// Parameter location. The valid values are PATH, QUERY and HEADER.
   334  	Location string `json:"location" required:"true"`
   335  	// Parameter value, which can contain a maximum of 255 characters. If the origin type is REQUEST, the value of this parameter is the parameter name in req_params.
   336  	// If the origin type is CONSTANT, the value is a constant.
   337  	// If the origin type is SYSTEM, the value is a system parameter name. System parameters include gateway parameters, frontend authentication parameters, and backend authentication parameters. You can set the frontend or backend authentication parameters after enabling custom frontend or backend authentication.
   338  	// The gateway parameters are as follows:
   339  	//   $context.sourceIp: source IP address of the API caller.
   340  	//   $context.stage: deployment environment in which the API is called.
   341  	//   $context.apiId: API ID.
   342  	//   $context.appId: ID of the app used by the API caller.
   343  	//   $context.requestId: request ID generated when the API is called.
   344  	//   $context.serverAddr: address of the gateway server.
   345  	//   $context.serverName: name of the gateway server.
   346  	//   $context.handleTime: time when the API request is processed.
   347  	//   $context.providerAppId: ID of the app used by the API owner. This parameter is currently not supported.
   348  	// Frontend authentication parameter: prefixed with "$context.authorizer.frontend.". For example, to return "aaa" upon successful custom authentication, set this parameter to "$context.authorizer.frontend.aaa".
   349  	// Backend authentication parameter: prefixed with "$context.authorizer.backend.". For example, to return "aaa" upon successful custom authentication, set this parameter to "$context.authorizer.backend.aaa".
   350  	Value string `json:"value" required:"true"`
   351  	// Description, which can contain a maximum of 255 characters.
   352  	// Chinese characters must be in UTF-8 or Unicode format.
   353  	Description *string `json:"remark,omitempty"`
   354  }
   355  
   356  // APIConditionBase is an object which will be build up a policy condition.
   357  type APIConditionBase struct {
   358  	// Policy type. The valid types are as following:
   359  	//   param: input parameter
   360  	//   source: source IP address
   361  	ConditionOrigin string `json:"condition_origin" required:"true"`
   362  	// Condition value.
   363  	ConditionValue string `json:"condition_value" required:"true"`
   364  	// Input parameter name. This parameter is required if the policy type is param.
   365  	ReqParamName string `json:"req_param_name,omitempty"`
   366  	// Policy condition. The valid values are as following:
   367  	//   exact: exact match
   368  	//   enum: enumeration
   369  	//   pattern: regular expression
   370  	// This parameter is required if the policy type is param.
   371  	ConditionType string `json:"condition_type,omitempty"`
   372  }
   373  
   374  // APIOptsBuilder is an interface which to support request body build of the API creation and updation.
   375  type APIOptsBuilder interface {
   376  	ToAPIOptsMap() (map[string]interface{}, error)
   377  }
   378  
   379  // ToAPIOptsMap is a method which to build a request body by the APIOpts.
   380  func (opts APIOpts) ToAPIOptsMap() (map[string]interface{}, error) {
   381  	return golangsdk.BuildRequestBody(opts, "")
   382  }
   383  
   384  // Create is a method by which to create function that create a new custom API.
   385  func Create(client *golangsdk.ServiceClient, instanceId string, opts APIOptsBuilder) (r CreateResult) {
   386  	reqBody, err := opts.ToAPIOptsMap()
   387  	if err != nil {
   388  		r.Err = err
   389  		return
   390  	}
   391  	_, r.Err = client.Post(rootURL(client, instanceId), reqBody, &r.Body, nil)
   392  	return
   393  }
   394  
   395  // Update is a method to update an existing custom API.
   396  func Update(client *golangsdk.ServiceClient, instanceId, appId string, opts APIOptsBuilder) (r UpdateResult) {
   397  	reqBody, err := opts.ToAPIOptsMap()
   398  	if err != nil {
   399  		r.Err = err
   400  		return
   401  	}
   402  	_, r.Err = client.Put(resourceURL(client, instanceId, appId), reqBody, &r.Body, &golangsdk.RequestOpts{
   403  		OkCodes: []int{200},
   404  	})
   405  	return
   406  }
   407  
   408  // Get is a method to obtain the specified API according to the instanceId and API ID.
   409  func Get(client *golangsdk.ServiceClient, instanceId, apiId string) (r GetResult) {
   410  	_, r.Err = client.Get(resourceURL(client, instanceId, apiId), &r.Body, nil)
   411  	return
   412  }
   413  
   414  // ListOpts allows to filter list data using given parameters.
   415  type ListOpts struct {
   416  	// API ID.
   417  	ID string `q:"id"`
   418  	// API name.
   419  	Name string `q:"name"`
   420  	// API group ID.
   421  	GroupId string `q:"group_id"`
   422  	// Request protocol.
   423  	ReqProtocol string `q:"req_protocol"`
   424  	// Request method.
   425  	ReqMethod string `q:"req_method"`
   426  	// Request path.
   427  	ReqURI string `q:"req_uri"`
   428  	// Security authentication mode.
   429  	AuthType string `q:"auth_type"`
   430  	// ID of the environment in which the API has been published.
   431  	EnvId string `q:"env_id"`
   432  	// API type.
   433  	Type int `q:"type"`
   434  	// Offset from which the query starts.
   435  	// If the offset is less than 0, the value is automatically converted to 0. Default to 0.
   436  	Offset int `q:"offset"`
   437  	// Number of items displayed on each page. The range of number is form 1 to 500, default to 20.
   438  	Limit int `q:"limit"`
   439  	// Parameter name (name or req_uri) for exact matching.
   440  	PreciseSearch string `q:"precise_search"`
   441  }
   442  
   443  // ListOptsBuilder is an interface which to support request query build of the API search.
   444  type ListOptsBuilder interface {
   445  	ToListOptsQuery() (string, error)
   446  }
   447  
   448  // ToListOptsQuery is a method which to build a request query by the ListOpts.
   449  func (opts ListOpts) ToListOptsQuery() (string, error) {
   450  	q, err := golangsdk.BuildQueryString(opts)
   451  	if err != nil {
   452  		return "", err
   453  	}
   454  	return q.String(), err
   455  }
   456  
   457  // List is a method to obtain an array of one or more APIs according to the query parameters.
   458  func List(client *golangsdk.ServiceClient, instanceId string, opts ListOptsBuilder) pagination.Pager {
   459  	url := rootURL(client, instanceId)
   460  	if opts != nil {
   461  		query, err := opts.ToListOptsQuery()
   462  		if err != nil {
   463  			return pagination.Pager{Err: err}
   464  		}
   465  		url += query
   466  	}
   467  
   468  	return pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page {
   469  		return APIPage{pagination.SinglePageBase(r)}
   470  	})
   471  }
   472  
   473  // Delete is a method to delete an existing custom API.
   474  func Delete(client *golangsdk.ServiceClient, instanceId, apiId string) (r DeleteResult) {
   475  	_, r.Err = client.Delete(resourceURL(client, instanceId, apiId), nil)
   476  	return
   477  }