Files
my-rook-config/tests/framework/clients/object.go
T
Bassam Tabbara e4b1db9bc9 tests: refactor integration tests
refactor integration tests splitting out the kubernetes
cluster setup to just be in a script and making it the reponsibility
of the host/user/jenkins.

integration tests now run just like unit tests using "go test".
2017-06-29 15:20:28 -07:00

93 lines
3.1 KiB
Go

/*
Copyright 2016 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package clients
import (
"github.com/rook/rook/pkg/model"
"github.com/rook/rook/tests/framework/contracts"
)
type ObjectOperation struct {
restClient contracts.RestAPIOperator
}
func CreateObjectOperation(rookRestClient contracts.RestAPIOperator) *ObjectOperation {
return &ObjectOperation{restClient: rookRestClient}
}
//Function to create a object store in rook
//Input paramatres -None
//Output - output returned by rook Rest API client
func (ro *ObjectOperation) ObjectCreate() (string, error) {
return ro.restClient.CreateObjectStore()
}
//Function to get Buckets present in rook object store
//Input paramatres - None
//Output - output returned by rook Rest API client
func (ro *ObjectOperation) ObjectBucketList() ([]model.ObjectBucket, error) {
return ro.restClient.ListBuckets()
}
//Function to get connection information for a user
//Input paramatres - None
//Output - output returned by rook Rest API client
func (ro *ObjectOperation) ObjectConnection() (*model.ObjectStoreConnectInfo, error) {
return ro.restClient.GetObjectStoreConnectionInfo()
}
//Function to create user on rook object store
//Input paramatres - userId and display Name
//Output - output returned by rook Rest API client
func (ro *ObjectOperation) ObjectCreateUser(userid string, displayname string) (*model.ObjectUser, error) {
objectUser := model.ObjectUser{UserID: userid, DisplayName: &displayname}
return ro.restClient.CreateObjectUser(objectUser)
}
//Function to update a user on rook object store
//Input paramatres - userId,display Name and email address
//Output - output returned by rook Rest API client
func (ro *ObjectOperation) ObjectUpdateUser(userid string, displayname string, emailid string) (*model.ObjectUser, error) {
objectUser := model.ObjectUser{UserID: userid, DisplayName: &displayname, Email: &emailid}
return ro.restClient.UpdateObjectUser(objectUser)
}
//Function to delete user on rook object store
//Input paramatres - userId
//Output - output returned by rook Rest API client
func (ro *ObjectOperation) ObjectDeleteUser(userid string) error {
return ro.restClient.DeleteObjectUser(userid)
}
//Function to get a user on rook object store
//Input paramatres - userId
//Output - output returned by rook Rest API client
func (ro *ObjectOperation) ObjectGetUser(userid string) (*model.ObjectUser, error) {
return ro.restClient.GetObjectUser(userid)
}
//Function to get all users on rook object store
//Input paramatres - none
//Output - output returned by rook Rest API client
func (ro *ObjectOperation) ObjectListUser() ([]model.ObjectUser, error) {
return ro.restClient.ListObjectUsers()
}