github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/db/v1/configurations/testing/fixtures.go (about)

     1  package testing
     2  
     3  import (
     4  	"fmt"
     5  	"time"
     6  
     7  	"github.com/huaweicloud/golangsdk"
     8  	"github.com/huaweicloud/golangsdk/openstack/db/v1/configurations"
     9  )
    10  
    11  var (
    12  	timestamp  = "2015-11-12T14:22:42"
    13  	timeVal, _ = time.Parse(golangsdk.RFC3339NoZ, timestamp)
    14  )
    15  
    16  var singleConfigJSON = `
    17  {
    18    "created": "` + timestamp + `",
    19    "datastore_name": "mysql",
    20    "datastore_version_id": "b00000b0-00b0-0b00-00b0-000b000000bb",
    21    "datastore_version_name": "5.6",
    22    "description": "example_description",
    23    "id": "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
    24    "name": "example-configuration-name",
    25    "updated": "` + timestamp + `"
    26  }
    27  `
    28  
    29  var singleConfigWithValuesJSON = `
    30  {
    31    "created": "` + timestamp + `",
    32    "datastore_name": "mysql",
    33    "datastore_version_id": "b00000b0-00b0-0b00-00b0-000b000000bb",
    34    "datastore_version_name": "5.6",
    35    "description": "example description",
    36    "id": "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
    37    "instance_count": 0,
    38    "name": "example-configuration-name",
    39    "updated": "` + timestamp + `",
    40    "values": {
    41      "collation_server": "latin1_swedish_ci",
    42      "connect_timeout": 120
    43    }
    44  }
    45  `
    46  
    47  var (
    48  	ListConfigsJSON  = fmt.Sprintf(`{"configurations": [%s]}`, singleConfigJSON)
    49  	GetConfigJSON    = fmt.Sprintf(`{"configuration": %s}`, singleConfigJSON)
    50  	CreateConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigWithValuesJSON)
    51  )
    52  
    53  var CreateReq = `
    54  {
    55    "configuration": {
    56      "datastore": {
    57        "type": "a00000a0-00a0-0a00-00a0-000a000000aa",
    58        "version": "b00000b0-00b0-0b00-00b0-000b000000bb"
    59      },
    60      "description": "example description",
    61      "name": "example-configuration-name",
    62      "values": {
    63        "collation_server": "latin1_swedish_ci",
    64        "connect_timeout": 120
    65      }
    66    }
    67  }
    68  `
    69  
    70  var UpdateReq = `
    71  {
    72    "configuration": {
    73      "values": {
    74        "connect_timeout": 300
    75      }
    76    }
    77  }
    78  `
    79  
    80  var ListInstancesJSON = `
    81  {
    82    "instances": [
    83      {
    84        "id": "d4603f69-ec7e-4e9b-803f-600b9205576f",
    85        "name": "json_rack_instance"
    86      }
    87    ]
    88  }
    89  `
    90  
    91  var ListParamsJSON = `
    92  {
    93    "configuration-parameters": [
    94      {
    95        "max": 1,
    96        "min": 0,
    97        "name": "innodb_file_per_table",
    98        "restart_required": true,
    99        "type": "integer"
   100      },
   101      {
   102        "max": 4294967296,
   103        "min": 0,
   104        "name": "key_buffer_size",
   105        "restart_required": false,
   106        "type": "integer"
   107      },
   108      {
   109        "max": 65535,
   110        "min": 2,
   111        "name": "connect_timeout",
   112        "restart_required": false,
   113        "type": "integer"
   114      },
   115      {
   116        "max": 4294967296,
   117        "min": 0,
   118        "name": "join_buffer_size",
   119        "restart_required": false,
   120        "type": "integer"
   121      }
   122    ]
   123  }
   124  `
   125  
   126  var GetParamJSON = `
   127  {
   128    "max": 1,
   129    "min": 0,
   130    "name": "innodb_file_per_table",
   131    "restart_required": true,
   132    "type": "integer"
   133  }
   134  `
   135  
   136  var ExampleConfig = configurations.Config{
   137  	Created:              timeVal,
   138  	DatastoreName:        "mysql",
   139  	DatastoreVersionID:   "b00000b0-00b0-0b00-00b0-000b000000bb",
   140  	DatastoreVersionName: "5.6",
   141  	Description:          "example_description",
   142  	ID:                   "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
   143  	Name:                 "example-configuration-name",
   144  	Updated:              timeVal,
   145  }
   146  
   147  var ExampleConfigWithValues = configurations.Config{
   148  	Created:              timeVal,
   149  	DatastoreName:        "mysql",
   150  	DatastoreVersionID:   "b00000b0-00b0-0b00-00b0-000b000000bb",
   151  	DatastoreVersionName: "5.6",
   152  	Description:          "example description",
   153  	ID:                   "005a8bb7-a8df-40ee-b0b7-fc144641abc2",
   154  	Name:                 "example-configuration-name",
   155  	Updated:              timeVal,
   156  	Values: map[string]interface{}{
   157  		"collation_server": "latin1_swedish_ci",
   158  		"connect_timeout":  float64(120),
   159  	},
   160  }