Skip to content

Commit c634f0a

Browse files
authored
Merge pull request #50 from RachelTucker/tapetype-to-string
SA-217: Updated TapeType to string
2 parents 3f56089 + a7ead45 commit c634f0a

23 files changed

+46
-145
lines changed

ds3/ds3Client_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ func TestGetTapesSpectraS3(t *testing.T) {
13981398
ds3Testing.AssertNonNilStringPtr(t, "SerialNumber", "HP-W130501213", tape.SerialNumber)
13991399
ds3Testing.AssertString(t, "State", models.TAPE_STATE_NORMAL.String(), tape.State.String())
14001400
ds3Testing.AssertNonNilInt64Ptr(t, "TotalRawCapacity", 2408088338432, tape.TotalRawCapacity)
1401-
ds3Testing.AssertString(t, "Type", models.TAPE_TYPE_LTO6.String(), tape.Type.String())
1401+
ds3Testing.AssertString(t, "Type", "LTO6", tape.Type)
14021402
ds3Testing.AssertBool(t, "WriteProtected", false, tape.WriteProtected)
14031403

14041404
ds3Testing.AssertString(t, "Page-Truncated header", "2", response.Headers.Get("Page-Truncated"))
@@ -1464,7 +1464,7 @@ func TestGetTapeSpectraS3(t *testing.T) {
14641464
ds3Testing.AssertNonNilStringPtr(t, "SerialNumber", "HP-W130501213", tape.SerialNumber)
14651465
ds3Testing.AssertString(t, "State", models.TAPE_STATE_NORMAL.String(), tape.State.String())
14661466
ds3Testing.AssertNonNilInt64Ptr(t, "TotalRawCapacity", 2408088338432, tape.TotalRawCapacity)
1467-
ds3Testing.AssertString(t, "Type", models.TAPE_TYPE_LTO6.String(), tape.Type.String())
1467+
ds3Testing.AssertString(t, "Type", "LTO6", tape.Type)
14681468
ds3Testing.AssertBool(t, "WriteProtected", false, tape.WriteProtected)
14691469
}
14701470

@@ -1905,9 +1905,7 @@ func TestVerifyPhysicalPlacementForObjectsWithFullDetailsSpectraS3(t *testing.T)
19051905
ds3Testing.AssertStringPtrIsNil(t, "StorageDomainId", tape.StorageDomainId)
19061906
ds3Testing.AssertBool(t, "TakeOwnershipPending", false, tape.TakeOwnershipPending)
19071907
ds3Testing.AssertNonNilInt64Ptr(t, "TotalRawCapacity", 20000, tape.TotalRawCapacity)
1908-
if tape.Type != models.TAPE_TYPE_LTO5 {
1909-
t.Fatalf("Expected type 'TAPE_TYPE_LTO5' but got '%s'.", tape.Type.String())
1910-
}
1908+
ds3Testing.AssertString(t, "TapeType", "LTO5", tape.Type)
19111909
if tape.VerifyPending != nil {
19121910
t.Fatalf("Expected Verify Pending to be 'nil' but was '%s'.", tape.VerifyPending.String())
19131911
}

ds3/ds3Gets.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ func (client *Client) GetBucketCapacitySummarySpectraS3(request *models.GetBucke
409409
WithOptionalQueryParam("pool_state", networking.InterfaceToStrPtr(request.PoolState)).
410410
WithOptionalQueryParam("pool_type", networking.InterfaceToStrPtr(request.PoolType)).
411411
WithOptionalQueryParam("tape_state", networking.InterfaceToStrPtr(request.TapeState)).
412-
WithOptionalQueryParam("tape_type", networking.InterfaceToStrPtr(request.TapeType)).
412+
WithOptionalQueryParam("tape_type", request.TapeType).
413413
Build(client.connectionInfo)
414414

415415
if err != nil {
@@ -439,7 +439,7 @@ func (client *Client) GetStorageDomainCapacitySummarySpectraS3(request *models.G
439439
WithOptionalQueryParam("pool_state", networking.InterfaceToStrPtr(request.PoolState)).
440440
WithOptionalQueryParam("pool_type", networking.InterfaceToStrPtr(request.PoolType)).
441441
WithOptionalQueryParam("tape_state", networking.InterfaceToStrPtr(request.TapeState)).
442-
WithOptionalQueryParam("tape_type", networking.InterfaceToStrPtr(request.TapeType)).
442+
WithOptionalQueryParam("tape_type", request.TapeType).
443443
Build(client.connectionInfo)
444444

445445
if err != nil {
@@ -468,7 +468,7 @@ func (client *Client) GetSystemCapacitySummarySpectraS3(request *models.GetSyste
468468
WithOptionalQueryParam("pool_state", networking.InterfaceToStrPtr(request.PoolState)).
469469
WithOptionalQueryParam("pool_type", networking.InterfaceToStrPtr(request.PoolType)).
470470
WithOptionalQueryParam("tape_state", networking.InterfaceToStrPtr(request.TapeState)).
471-
WithOptionalQueryParam("tape_type", networking.InterfaceToStrPtr(request.TapeType)).
471+
WithOptionalQueryParam("tape_type", request.TapeType).
472472
Build(client.connectionInfo)
473473

474474
if err != nil {
@@ -2901,7 +2901,7 @@ func (client *Client) GetStorageDomainMembersSpectraS3(request *models.GetStorag
29012901
WithOptionalQueryParam("state", networking.InterfaceToStrPtr(request.State)).
29022902
WithOptionalQueryParam("storage_domain_id", request.StorageDomainId).
29032903
WithOptionalQueryParam("tape_partition_id", request.TapePartitionId).
2904-
WithOptionalQueryParam("tape_type", networking.InterfaceToStrPtr(request.TapeType)).
2904+
WithOptionalQueryParam("tape_type", request.TapeType).
29052905
WithOptionalQueryParam("write_preference", networking.InterfaceToStrPtr(request.WritePreference)).
29062906
Build(client.connectionInfo)
29072907

@@ -3151,7 +3151,7 @@ func (client *Client) GetTapeDensityDirectivesSpectraS3(request *models.GetTapeD
31513151
WithOptionalQueryParam("page_offset", networking.IntPtrToStrPtr(request.PageOffset)).
31523152
WithOptionalQueryParam("page_start_marker", request.PageStartMarker).
31533153
WithOptionalQueryParam("partition_id", request.PartitionId).
3154-
WithOptionalQueryParam("tape_type", networking.InterfaceToStrPtr(request.TapeType)).
3154+
WithOptionalQueryParam("tape_type", request.TapeType).
31553155
Build(client.connectionInfo)
31563156

31573157
if err != nil {
@@ -3511,7 +3511,7 @@ func (client *Client) GetTapesSpectraS3(request *models.GetTapesSpectraS3Request
35113511
WithOptionalQueryParam("sort_by", request.SortBy).
35123512
WithOptionalQueryParam("state", networking.InterfaceToStrPtr(request.State)).
35133513
WithOptionalQueryParam("storage_domain_id", request.StorageDomainId).
3514-
WithOptionalQueryParam("type", networking.InterfaceToStrPtr(request.TapeType)).
3514+
WithOptionalQueryParam("type", request.String).
35153515
WithOptionalQueryParam("verify_pending", networking.InterfaceToStrPtr(request.VerifyPending)).
35163516
WithOptionalQueryParam("write_protected", networking.BoolPtrToStrPtr(request.WriteProtected)).
35173517
Build(client.connectionInfo)

ds3/ds3Posts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ func (client *Client) PutTapeStorageDomainMemberSpectraS3(request *models.PutTap
10181018
WithPath("/_rest_/storage_domain_member").
10191019
WithQueryParam("storage_domain_id", request.StorageDomainId).
10201020
WithQueryParam("tape_partition_id", request.TapePartitionId).
1021-
WithQueryParam("tape_type", request.TapeType.String()).
1021+
WithQueryParam("tape_type", request.TapeType).
10221022
WithOptionalQueryParam("write_preference", networking.InterfaceToStrPtr(request.WritePreference)).
10231023
Build(client.connectionInfo)
10241024

@@ -1045,7 +1045,7 @@ func (client *Client) PutTapeDensityDirectiveSpectraS3(request *models.PutTapeDe
10451045
WithPath("/_rest_/tape_density_directive").
10461046
WithQueryParam("density", request.Density.String()).
10471047
WithQueryParam("partition_id", request.PartitionId).
1048-
WithQueryParam("tape_type", request.TapeType.String()).
1048+
WithQueryParam("tape_type", request.TapeType).
10491049
Build(client.connectionInfo)
10501050

10511051
if err != nil {

ds3/models/detailedTapePartition.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ type DetailedTapePartition struct {
2525
SerialId *string
2626
SerialNumber *string
2727
State TapePartitionState
28-
TapeTypes []TapeType
28+
TapeTypes []string
2929
}

ds3/models/detailedTapePartitionParser.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ func (detailedTapePartition *DetailedTapePartition) parse(xmlNode *XmlNode, aggE
4545
case "State":
4646
parseEnum(child.Content, &detailedTapePartition.State, aggErr)
4747
case "TapeTypes":
48-
var model TapeType
49-
parseEnum(child.Content, &model, aggErr)
50-
detailedTapePartition.TapeTypes = append(detailedTapePartition.TapeTypes, model)
48+
var str = parseString(child.Content)
49+
detailedTapePartition.TapeTypes = append(detailedTapePartition.TapeTypes, str)
5150
default:
5251
log.Printf("WARNING: unable to parse unknown xml tag '%s' while parsing DetailedTapePartition.", child.XMLName.Local)
5352
}

ds3/models/getBucketCapacitySummarySpectraS3Request.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type GetBucketCapacitySummarySpectraS3Request struct {
2020
PoolType PoolType
2121
StorageDomainId string
2222
TapeState TapeState
23-
TapeType TapeType
23+
TapeType *string
2424
}
2525

2626
func NewGetBucketCapacitySummarySpectraS3Request(bucketId string, storageDomainId string) *GetBucketCapacitySummarySpectraS3Request {
@@ -50,8 +50,8 @@ func (getBucketCapacitySummarySpectraS3Request *GetBucketCapacitySummarySpectraS
5050
return getBucketCapacitySummarySpectraS3Request
5151
}
5252

53-
func (getBucketCapacitySummarySpectraS3Request *GetBucketCapacitySummarySpectraS3Request) WithTapeType(tapeType TapeType) *GetBucketCapacitySummarySpectraS3Request {
54-
getBucketCapacitySummarySpectraS3Request.TapeType = tapeType
53+
func (getBucketCapacitySummarySpectraS3Request *GetBucketCapacitySummarySpectraS3Request) WithTapeType(tapeType string) *GetBucketCapacitySummarySpectraS3Request {
54+
getBucketCapacitySummarySpectraS3Request.TapeType = &tapeType
5555
return getBucketCapacitySummarySpectraS3Request
5656
}
5757

ds3/models/getObjectRequest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ func (getObjectRequest *GetObjectRequest) WithRanges(ranges ...Range) *GetObject
6565
}
6666
getObjectRequest.Metadata["Range"] = fmt.Sprintf("bytes=%s", strings.Join(rangeElements[:], ","))
6767
return getObjectRequest
68-
}
68+
}

ds3/models/getStorageDomainCapacitySummarySpectraS3Request.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type GetStorageDomainCapacitySummarySpectraS3Request struct {
1919
PoolType PoolType
2020
StorageDomainId string
2121
TapeState TapeState
22-
TapeType TapeType
22+
TapeType *string
2323
}
2424

2525
func NewGetStorageDomainCapacitySummarySpectraS3Request(storageDomainId string) *GetStorageDomainCapacitySummarySpectraS3Request {
@@ -48,8 +48,8 @@ func (getStorageDomainCapacitySummarySpectraS3Request *GetStorageDomainCapacityS
4848
return getStorageDomainCapacitySummarySpectraS3Request
4949
}
5050

51-
func (getStorageDomainCapacitySummarySpectraS3Request *GetStorageDomainCapacitySummarySpectraS3Request) WithTapeType(tapeType TapeType) *GetStorageDomainCapacitySummarySpectraS3Request {
52-
getStorageDomainCapacitySummarySpectraS3Request.TapeType = tapeType
51+
func (getStorageDomainCapacitySummarySpectraS3Request *GetStorageDomainCapacitySummarySpectraS3Request) WithTapeType(tapeType string) *GetStorageDomainCapacitySummarySpectraS3Request {
52+
getStorageDomainCapacitySummarySpectraS3Request.TapeType = &tapeType
5353
return getStorageDomainCapacitySummarySpectraS3Request
5454
}
5555

ds3/models/getStorageDomainMembersSpectraS3Request.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type GetStorageDomainMembersSpectraS3Request struct {
2222
State StorageDomainMemberState
2323
StorageDomainId *string
2424
TapePartitionId *string
25-
TapeType TapeType
25+
TapeType *string
2626
WritePreference WritePreferenceLevel
2727
}
2828

@@ -71,8 +71,8 @@ func (getStorageDomainMembersSpectraS3Request *GetStorageDomainMembersSpectraS3R
7171
return getStorageDomainMembersSpectraS3Request
7272
}
7373

74-
func (getStorageDomainMembersSpectraS3Request *GetStorageDomainMembersSpectraS3Request) WithTapeType(tapeType TapeType) *GetStorageDomainMembersSpectraS3Request {
75-
getStorageDomainMembersSpectraS3Request.TapeType = tapeType
74+
func (getStorageDomainMembersSpectraS3Request *GetStorageDomainMembersSpectraS3Request) WithTapeType(tapeType string) *GetStorageDomainMembersSpectraS3Request {
75+
getStorageDomainMembersSpectraS3Request.TapeType = &tapeType
7676
return getStorageDomainMembersSpectraS3Request
7777
}
7878

ds3/models/getSystemCapacitySummarySpectraS3Request.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type GetSystemCapacitySummarySpectraS3Request struct {
1818
PoolState PoolState
1919
PoolType PoolType
2020
TapeState TapeState
21-
TapeType TapeType
21+
TapeType *string
2222
}
2323

2424
func NewGetSystemCapacitySummarySpectraS3Request() *GetSystemCapacitySummarySpectraS3Request {
@@ -46,8 +46,8 @@ func (getSystemCapacitySummarySpectraS3Request *GetSystemCapacitySummarySpectraS
4646
return getSystemCapacitySummarySpectraS3Request
4747
}
4848

49-
func (getSystemCapacitySummarySpectraS3Request *GetSystemCapacitySummarySpectraS3Request) WithTapeType(tapeType TapeType) *GetSystemCapacitySummarySpectraS3Request {
50-
getSystemCapacitySummarySpectraS3Request.TapeType = tapeType
49+
func (getSystemCapacitySummarySpectraS3Request *GetSystemCapacitySummarySpectraS3Request) WithTapeType(tapeType string) *GetSystemCapacitySummarySpectraS3Request {
50+
getSystemCapacitySummarySpectraS3Request.TapeType = &tapeType
5151
return getSystemCapacitySummarySpectraS3Request
5252
}
5353

0 commit comments

Comments
 (0)