Statistics
| Branch: | Tag: | Revision:

root / Classes / LoadBalancerUsage.m @ 72744ed1

History | View | Annotate | Download (1.3 kB)

1
//
2
//  LoadBalancerUsage.m
3
//  OpenStack
4
//
5
//  Created by Michael Mayo on 2/9/11.
6
//  Copyright 2011 __MyCompanyName__. All rights reserved.
7
//
8

    
9
#import "LoadBalancerUsage.h"
10
#import "NSObject+NSCoding.h"
11

    
12

    
13
@implementation LoadBalancerUsage
14

    
15
@synthesize identifier, averageNumConnections, incomingTransfer, outgoingTransfer, numVips, numPolls, startTime, endTime;
16

    
17
#pragma mark - Serialization
18

    
19
- (void)encodeWithCoder: (NSCoder *)coder {
20
    [self autoEncodeWithCoder:coder];
21
}
22

    
23
- (id)initWithCoder:(NSCoder *)coder {
24
    if ((self = [super init])) {
25
        [self autoDecode:coder];
26
    }
27
    
28
    return self;
29
}
30

    
31
#pragma mark - JSON
32

    
33
+ (LoadBalancerUsage *)fromJSON:(NSDictionary *)dict {
34
    LoadBalancerUsage *u = [[[LoadBalancerUsage alloc] init] autorelease];
35
    u.identifier = [dict objectForKey:@"id"];
36
    u.averageNumConnections = [[dict objectForKey:@"averageNumConnections"] doubleValue];
37
    u.incomingTransfer = [[dict objectForKey:@"incomingTransfer"] longLongValue];
38
    u.outgoingTransfer = [[dict objectForKey:@"outgoingTransfer"] longLongValue];
39
    u.numVips = [[dict objectForKey:@"numVips"] intValue];
40
    u.numPolls = [[dict objectForKey:@"numPolls"] intValue];
41
    return u;
42
}
43

    
44
#pragma mark - Memory Management
45

    
46
- (void)dealloc {
47
    [identifier release];
48
    [startTime release];
49
    [endTime release];
50
    [super dealloc];
51
}
52

    
53
@end