github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/imageservice/v2/tasks/testing/fixtures.go (about)

     1  package testing
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/huaweicloud/golangsdk/openstack/imageservice/v2/tasks"
     7  )
     8  
     9  // TasksListResult represents raw server response from a server to a list call.
    10  const TasksListResult = `
    11  {
    12      "schema": "/v2/schemas/tasks",
    13      "tasks": [
    14          {
    15              "status": "pending",
    16              "self": "/v2/tasks/1252f636-1246-4319-bfba-c47cde0efbe0",
    17              "updated_at": "2018-07-25T08:59:14Z",
    18              "id": "1252f636-1246-4319-bfba-c47cde0efbe0",
    19              "owner": "424e7cf0243c468ca61732ba45973b3e",
    20              "type": "import",
    21              "created_at": "2018-07-25T08:59:13Z",
    22              "schema": "/v2/schemas/task"
    23          },
    24          {
    25              "status": "processing",
    26              "self": "/v2/tasks/349a51f4-d51d-47b6-82da-4fa516f0ca32",
    27              "updated_at": "2018-07-25T08:56:19Z",
    28              "id": "349a51f4-d51d-47b6-82da-4fa516f0ca32",
    29              "owner": "fb57277ef2f84a0e85b9018ec2dedbf7",
    30              "type": "import",
    31              "created_at": "2018-07-25T08:56:17Z",
    32              "schema": "/v2/schemas/task"
    33          }
    34      ],
    35      "first": "/v2/tasks?sort_key=status&sort_dir=desc&limit=20"
    36  }
    37  `
    38  
    39  // Task1 is an expected representation of a first task from the TasksListResult.
    40  var Task1 = tasks.Task{
    41  	ID:        "1252f636-1246-4319-bfba-c47cde0efbe0",
    42  	Status:    string(tasks.TaskStatusPending),
    43  	Type:      "import",
    44  	Owner:     "424e7cf0243c468ca61732ba45973b3e",
    45  	CreatedAt: time.Date(2018, 7, 25, 8, 59, 13, 0, time.UTC),
    46  	UpdatedAt: time.Date(2018, 7, 25, 8, 59, 14, 0, time.UTC),
    47  	Self:      "/v2/tasks/1252f636-1246-4319-bfba-c47cde0efbe0",
    48  	Schema:    "/v2/schemas/task",
    49  }
    50  
    51  // Task2 is an expected representation of a first task from the TasksListResult.
    52  var Task2 = tasks.Task{
    53  	ID:        "349a51f4-d51d-47b6-82da-4fa516f0ca32",
    54  	Status:    string(tasks.TaskStatusProcessing),
    55  	Type:      "import",
    56  	Owner:     "fb57277ef2f84a0e85b9018ec2dedbf7",
    57  	CreatedAt: time.Date(2018, 7, 25, 8, 56, 17, 0, time.UTC),
    58  	UpdatedAt: time.Date(2018, 7, 25, 8, 56, 19, 0, time.UTC),
    59  	Self:      "/v2/tasks/349a51f4-d51d-47b6-82da-4fa516f0ca32",
    60  	Schema:    "/v2/schemas/task",
    61  }
    62  
    63  // TasksGetResult represents raw server response from a server to a get call.
    64  const TasksGetResult = `
    65  {
    66      "status": "pending",
    67      "created_at": "2018-07-25T08:59:13Z",
    68      "updated_at": "2018-07-25T08:59:14Z",
    69      "self": "/v2/tasks/1252f636-1246-4319-bfba-c47cde0efbe0",
    70      "result": null,
    71      "owner": "424e7cf0243c468ca61732ba45973b3e",
    72      "input": {
    73          "image_properties": {
    74              "container_format": "bare",
    75              "disk_format": "raw"
    76          },
    77          "import_from_format": "raw",
    78          "import_from": "http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img"
    79      },
    80      "message": "",
    81      "type": "import",
    82      "id": "1252f636-1246-4319-bfba-c47cde0efbe0",
    83      "schema": "/v2/schemas/task"
    84  }
    85  `
    86  
    87  // TaskCreateRequest represents a request to create a task.
    88  const TaskCreateRequest = `
    89  {
    90      "input": {
    91          "image_properties": {
    92              "container_format": "bare",
    93              "disk_format": "raw"
    94          },
    95          "import_from_format": "raw",
    96          "import_from": "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img"
    97      },
    98      "type": "import"
    99  }
   100  `
   101  
   102  // TaskCreateResult represents a raw server response to the TaskCreateRequest.
   103  const TaskCreateResult = `
   104  {
   105      "status": "pending",
   106      "created_at": "2018-07-25T11:07:54Z",
   107      "updated_at": "2018-07-25T11:07:54Z",
   108      "self": "/v2/tasks/d550c87d-86ed-430a-9895-c7a1f5ce87e9",
   109      "result": null,
   110      "owner": "fb57277ef2f84a0e85b9018ec2dedbf7",
   111      "input": {
   112          "image_properties": {
   113              "container_format": "bare",
   114              "disk_format": "raw"
   115          },
   116          "import_from_format": "raw",
   117          "import_from": "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img"
   118      },
   119      "message": "",
   120      "type": "import",
   121      "id": "d550c87d-86ed-430a-9895-c7a1f5ce87e9",
   122      "schema": "/v2/schemas/task"
   123  }
   124  `