HP Matrix Operating Environment Software manual

Page 99

if len (self.service) >0:

servicefilter = chargebackservice.factory.create('serviceFilter') servicefilter.filterAttribute = attributefilter.SERVICE_NAME servicefilter.filterOperator = operatorfilter.EQUAL servicefilter.serviceFilterValue = self.service servicefilter.filterConnector = connectorfilter.AND filterCollection.append(servicefilter)

if len(filterCollection) > 0: filterCollection[0].filterConnector = connectorfilter.NONE

return filterCollection

def get_servicename(serviceUsage):

return str(serviceUsage.serviceInformation.name)

def get_organization(serviceUsage):

return str(serviceUsage.serviceInformation.organizationId)

def get_billingcode(serviceUsage):

return str(serviceUsage.serviceInformation.billingCode)

def get_owner(serviceUsage):

return str(serviceUsage.serviceInformation.owner)

def get_startdate(serviceUsage):

return str(serviceUsage.serviceInformation.startDate)

def get_enddate(serviceUsage): try:

return str(serviceUsage.serviceInformation.endDate) except:

return ""

def report_Summary(number_of_service, period): result = [[]]

result[0] = Paragraph(''' ''', styleSheet["BodyText"])

summarytable = [[]]

now = datetime.datetime.now()

summarytable[0] = ["Date run: ", now.strftime("%Y-%m-%d")]

start_date = datetime.datetime.strptime (period.start, "%Y-%m-%d") end_date = datetime.datetime.strptime (period.end, "%Y-%m-%d") days = end_date - start_date

periodStr = "{0} to {1} ({2} days)"

summarytable.append(["Reporting period: ", periodStr.format(period.start, period.end, str(days.days))])

summarytable.append(["Number of services: ", number_of_service])

t = Table(summarytable, style=[('LINEABOVE', (0,0), (-1,0), 0.25, colors.black), ('LINEBELOW', (0,-1), (-1,-1), 0.25, colors.black), ('FONTSIZE', (0,0), (0,2), 9),

('FONTSIZE', (1,0), (1,2), 8),

('BOX', (0,0), (-1,-1), 0.25, colors.black)]

)

t.hAlign = "LEFT" result.append(t)

result.append(Paragraph(''' ''',styleSheet["BodyText"]))

result.append(Paragraph(''' ''',styleSheet["BodyText"]))

return result

class ServiceUsageReport (object):

def __init__ (self, periodInformation, connection, filters=None, title="Title", footer="Footer"): self.title = title

self.data = footer self.footer = "" self.period = periodInformation self.filters = filters self.chargebackservice = connection.client

def get_serviceCost(self, serviceUsage):

disckCost = serviceUsage.resourceUsageSummary.DiskUsageSummary.allocationCost ipCost = serviceUsage.resourceUsageSummary.IpAddressUsageSummary.allocationCost serversCost = serviceUsage.resourceUsageSummary.ServerUsageSummary.allocationCost fixedCost = serviceUsage.resourceUsageSummary.fixedCost

return disckCost + ipCost + serversCost + fixedCost

def get_totalServices(self, services): return len(services)

def format_data(self):

Elements = []

if self.chargebackservice :

dataPeriod = self.period.getPeriodObj(self.chargebackservice) paging = self.chargebackservice.factory.create('paging')

99

Image 99
Contents Abstract API and CLI Operations Reference Guide7.1 7.1 Update 1Contents CMS Data Model Contents Example Usage ExceptionsSample Java Client Accessing the Chargeback Web Service InterfacesRequiredParameterException Part I Matrix API Introduction New features in 7.1 Update Integration interface overviewIntroduction New features PowerCycleLogicalServersNew features in 7.1 LogicalServerInfo EditLogicalServers RemoveLogicalServersQuiesceCms UnquiesceCms GetCmsQuiesceStatus LogicalServerGroupDetailsTemplateInfo ServiceInfoChargeback RequestInfoSecurity Accessing the Web Service InterfacesAccessing Wsdl Command Line InterfaceList TemplateInfo OperationsImportTemplate ExportTemplateCreateService ServiceListServices GetServiceDeactivateService DeleteServiceActivateService ChangeServiceLeasePowerOffService ListRequests PowerOnServiceDeleteReplicaService RequestContinueRequest GetRequestInfoGetRequest SetRequestApprovalStateAddServersToLogicalServerGroup CancelRequestLogical Server Group GetLogicalServerGroupAddNewDiskToLogicalServerGroup AddDiskToLogicalServerGroupRawMappingTypeEnum SetLogicalServerGroupActiveServerCountLogicalServerDetails GetLogicalServerDeactivateLogicalServers LogicalServerInfoLogicalServerNotFound Exception Logical Server PowerOffLogicalServersPowerOnLogicalServers ActivateLogicalServersByteSizeEnum PowerCycleLogicalServersEditLogicalServers RemoveLogicalServersCreateServerPool Server PoolListServerPools GetServerPoolDeleteServerPool MoveServerToServerPoolAssignUsersToServerPool GetVmHost ServerUnassignUsersFromServerPool GetComputeServerSubnet SoftwareGetSanVolumeTemplate ListSanVolumesGetSanVolume ListSanVolumeTemplatesAssignTemplateToOrganization OrganizationListOrganizations GetOrganizationOrganizationName Returns None Exceptions By a Service Provider AdministratorAssignServerToOrganization UnassignServerFromOrganizationAssignSubnetToOrganization UnassignSubnetFromOrganizationAssignSoftwareToOrganization BeginCmsMaintenance UnassignSoftwareFromOrganizationSyncOrganizations QuiesceCms EndCmsMaintenanceCountRunningRequestsForCms AddCmsAddLoadBalancer LoadBalancerGetCmsQuiesceStatus ListLoadBalancersRemoveLoadBalancerCertificate SetLoadBalancerPasswordRemoveLoadBalancer AddLoadBalancerCertificateDeleteLogicalLoadBalancerGroup UnsetLoadBalancerPasswordLogicalLoadBalancer CreateLogicalLoadBalancerGroupGetFirewallRuleGroup FirewallRuleGroupAddLogicalLoadBalancerGroupMember RemoveLogicalLoadBalancerGroupMemberName AddRuleToFirewallRule AddRuleToFirewallRuleGroupRemoveRuleFromFirewallRuleGroup SyncFirewallRuleGroupsRemoveFloatingIPAddress FloatingIPAddressAddFloatingIPAddress MoveFloatingIPAddressListServerSnapshots ServerSnapshotReleaseFloatingIPAddress ListUnassociatedFloatingIPAddressesCreateServerSnapshot RevertServerSnapshotDeleteServerSnapshot Snapshot, recursively. Defaults to false Data Model Data ModelCmsQuiesceState ByteSizeByteSizeEnum CidrIpRangeCustomAddressAssignmentTypeAttribute CostCostFrequency CostFrequencyEnumCustomTemplateAttributes CustomStorageVolumeAttributeCustomProcessorAttribute CustomSubnetBindingAttributeDrMode DeploymentServiceDeploymentServiceType DeploymentServiceTypeEnumImageType FirewallRuleFirewallRuleGroupInfo FirewallRuleGroupDetailsLoadBalancerInfo IPTypeIPTypeEnum LeasePeriodLogicalDisk LogicalFirewallRuleGroupLogicalIPAddress LogicalLoadBalancerGroupMember LogicalLoadBalancerDetailsLogicalLoadBalancerGroupDetails LogicalLoadBalancerGroupInfoLogicalServerDetails LogicalLoadBalancerProtocolLogicalLoadBalancerProtocolEnum LogicalNetworkInterfaceServiceEntityStatus status LogicalServerGroupInfoLogicalServerInfo LogicalSubnet LogicalSoftwareNatType MessageSeverityMessageSeverityEnum NatEntryProcessorArchitectureEnum PacketProtocolPacketProtocolEnum ProcessorArchitectureRequestHistoryItemLevelEnum RequestDetailsRequestHistoryItem RequestHistoryItemLevelRequestTypeEnum RequestStatusRequestStatusEnum RequestTypeSanVolume SanVolumeStateSanVolumeStateEnum IDs of the cloud capacity pools in the server pool SanVolumeTemplateServerPool State cannot be determinedServerResource ServiceActionServiceActionTrigger trigger ServerPoolResourceNoteServiceEntityStatus ServiceActionTriggerServiceActionTriggerEnum ServiceDetailsSoftwareTypeEnum ServiceInfoSoftwareDiskDefinition SoftwareTypeStorageTypeEnum StorageProvisioningTypeStorageProvisioningTypeEnum StorageTypeTemplateInfo VirtualizationTypeVirtualizationTypeEnum Workflow VirtualSwitchVmHost VmHostDataStoreExceptions OrganizationNotFoundException SanVolumeNotFoundExceptionSanVolumeTemplateNotFoundException ServiceNotFoundExceptionUserNotFoundException SoftwareNotFoundExceptionSubnetNotFoundException TemplateNotFoundExceptionPhysical Server Maintenance Example Physical Server Maintenance ExampleExample Usage Sample Java Client Sample CodeSample Java Client Sample Code Sample Java Client IOClientPasswordHandler.java Sample Java Client Add this code Sample VisualStudio/.NET/C# ClientString.Format0s, DateTime.Now Sample VisualStudio/.NET/C# ClientPage Part II Chargeback API Chargeback Soap API Chargeback Soap APIAccessing the Chargeback Web Service Interfaces Accessing the Chargeback Web Service InterfacesHttps//cms-ip-address55443/hpio/chargeback/soap/v1?wsdl Operations Summary Usage ReportDetailed Usage Report List ServiceFilter Aggregated Usage ReportOne entry with consolidated data for the entire period ServiceUsagePage Data Model Period ServiceFilterServiceFilterAttribute enum FilterConnector enumDiskUsageSummary ServiceInformationResourceUsageSummary ServerUsageSummaryServiceUsageDetailPage ServiceUsagePageServiceUsageSummary AggregateServiceUsageIpAddressUsageDetail DiskUsageDetailChargebackException AuthenticationExceptionAuthorizationException ChargebackDataBaseExceptionPeriodStartDateGreaterThanEndDateException PeriodStartDateGreaterThanEndDateExceptionPeriodStartDateTooOldException RequiredParameterException Sample Python Client Sample Python ClientPage Pageindex = Example 2 reports.pyPage Sample Python Client 101 Sample Python Client 103 Example 3 GUI.pySample Python Client 105 Example 4 reportsfile.py 107 Sample Chargeback Usage ReportReferences ReferencesInformation to collect before contacting HP How to contact HPSupport and other resources Information to collect before contacting HPSubscribing to security bulletins Warranty informationHP authorized resellers Documentation feedbackRelated information Documentation and supportRelated information
Related manuals
Manual 79 pages 57.42 Kb Manual 12 pages 7.25 Kb