github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/css/v1/clusters/testing/fixtures.go (about)

     1  package testing
     2  
     3  import "fmt"
     4  
     5  const (
     6  	vpcID    = "fccd753c-91c3-40e2-852f-5ddf76d1a1b2"
     7  	subnetID = "af1c65ae-c494-4e24-acd8-81d6b355c9f1"
     8  	sgID     = "7e3fed21-1a44-4101-ab29-34e57124f614"
     9  	cmkID    = "42546bb1-8025-4ad1-868f-600729c341ae"
    10  
    11  	clusterID   = "ef683016-871e-48bc-bf93-74a29d60d214"
    12  	clusterName = "ES-Test"
    13  )
    14  
    15  const (
    16  	listResponseBody = `
    17  {
    18      "clusters": [
    19          {
    20              "datastore": {
    21                  "type": "elasticsearch",
    22                  "version": "7.6.2"
    23              },
    24              "instances": [
    25                  {
    26                      "status": "200",
    27                      "type": "ess",
    28                      "id": "c8c90973-924d-4201-b9ff-f32279c87d0e",
    29                      "name": "css-5492-ess-esn-1-1",
    30                      "specCode": "css.xlarge.2",
    31                      "azCode": "eu-de-01"
    32                  }
    33              ],
    34              "updated": "2020-12-01T07:47:34",
    35              "name": "css-5492",
    36              "created": "2020-12-01T07:47:34",
    37              "id": "66ea1e42-4ee2-44ad-bd80-c86e6d8c6b9e",
    38              "status": "200",
    39              "endpoint": "10.16.0.151:9200",
    40              "vpcId": "e7daa617-3ee6-4ff1-b042-8cda4a006a46",
    41              "subnetId": "6253dc44-24cd-4c0a-90b3-f965e7f4dcd4",
    42              "securityGroupId": "d478041e-bcbe-4d69-a492-b6122d774b7f",
    43              "httpsEnable": false,
    44              "authorityEnable": false,
    45              "diskEncrypted": true,
    46              "cmkId": "00f05033-f8ac-4ceb-a1ce-4072fadb6b28",
    47              "actionProgress": {},
    48              "actions": [],
    49              "tags": []
    50          },
    51          {
    52              "datastore": {
    53                  "type": "elasticsearch",
    54                  "version": "7.6.2"
    55              },
    56              "instances": [
    57                  {
    58                      "status": "200",
    59                      "type": "ess",
    60                      "id": "a24adddb-1553-4873-9978-9d064418f903",
    61                      "name": "css-1d01-ess-esn-1-1",
    62                      "specCode": "css.xlarge.2",
    63                      "azCode": "eu-de-01"
    64                  }
    65              ],
    66              "updated": "2020-11-26T10:08:44",
    67              "name": "css-1d01",
    68              "created": "2020-11-26T10:08:44",
    69              "id": "af5fbac7-b386-4305-b201-820a0f51f4f1",
    70              "status": "200",
    71              "endpoint": "10.16.0.124:9200",
    72              "vpcId": "e7daa617-3ee6-4ff1-b042-8cda4a006a46",
    73              "subnetId": "6253dc44-24cd-4c0a-90b3-f965e7f4dcd4",
    74              "securityGroupId": "d478041e-bcbe-4d69-a492-b6122d774b7f",
    75              "httpsEnable": true,
    76              "authorityEnable": false,
    77              "diskEncrypted": false,
    78              "cmkId": "",
    79              "actionProgress": {},
    80              "actions": [],
    81              "tags": []
    82          },
    83          {
    84              "datastore": {
    85                  "type": "elasticsearch",
    86                  "version": "7.6.2"
    87              },
    88              "instances": [
    89                  {
    90                      "status": "303",
    91                      "type": "ess",
    92                      "id": "071c7ecf-a11d-45bd-9564-201ceb7cfae3",
    93                      "name": "css-9b36-ess-esn-1-1",
    94                      "specCode": "css.xlarge.2",
    95                      "azCode": "eu-de-02"
    96                  }
    97              ],
    98              "updated": "2020-11-13T14:33:24",
    99              "name": "css-9b36",
   100              "created": "2020-11-13T14:33:26",
   101              "id": "cdb26954-c743-47dd-b23a-b693205eb2da",
   102              "status": "303",
   103              "endpoint": null,
   104              "vpcId": "e7daa617-3ee6-4ff1-b042-8cda4a006a46",
   105              "subnetId": "6253dc44-24cd-4c0a-90b3-f965e7f4dcd4",
   106              "securityGroupId": "d478041e-bcbe-4d69-a492-b6122d774b7f",
   107              "httpsEnable": true,
   108              "authorityEnable": true,
   109              "diskEncrypted": false,
   110              "cmkId": "",
   111              "actionProgress": {},
   112              "actions": [],
   113              "tags": []
   114          }
   115      ]
   116  }
   117  `
   118  )
   119  
   120  var (
   121  	createRequestBody = fmt.Sprintf(`
   122  {
   123      "cluster": {
   124          "name": "ES-Test",
   125          "instanceNum": 4,
   126          "instance": {
   127              "flavorRef": "css.large.8",
   128              "volume": {
   129                  "volume_type": "COMMON",
   130                  "size": 100
   131              },
   132              "nics": {
   133                  "vpcId": "%s",
   134                  "netId": "%s",
   135                  "securityGroupId": "%s"
   136              }
   137          },
   138          "httpsEnable": "false",
   139          "diskEncryption": {
   140              "systemEncrypted": "1",
   141              "systemCmkid": "%s"
   142          }
   143      }
   144  }
   145  `, vpcID, subnetID, sgID, cmkID)
   146  
   147  	createResponseBody = fmt.Sprintf(`
   148  {
   149    "cluster": {
   150      "id": "%s",
   151      "name": "%s"
   152    }
   153  }
   154  `, clusterID, clusterName)
   155  	getResponseBody = fmt.Sprintf(`
   156  {
   157      "datastore": {
   158          "type": "elasticsearch",
   159          "version": "7.6.2"
   160      },
   161      "instances": [
   162          {
   163              "status": "200",
   164              "type": "ess",
   165              "id": "c2f29369-1985-4028-8e72-89cbb96a299d",
   166              "name": "%s-ess-esn-1-1",
   167              "specCode": "css.xlarge.2",
   168              "azCode": "eu-de-01"
   169          }
   170      ],
   171      "updated": "2020-12-03T07:02:08",
   172      "name": "%[1]s",
   173      "created": "2020-12-03T07:02:08",
   174      "id": "%s",
   175      "status": "200",
   176      "endpoint": "10.16.0.88:9200",
   177      "vpcId": "%s",
   178      "subnetId": "%s",
   179      "securityGroupId": "%s",
   180      "httpsEnable": true,
   181      "authorityEnable": true,
   182      "diskEncrypted": false,
   183      "actionProgress": {},
   184      "actions": [],
   185      "tags": []
   186  }
   187  `, clusterName, clusterID, vpcID, subnetID, sgID)
   188  )