├── CHANGELOG.md ├── internal ├── pkg.go └── testing │ └── pkg.go ├── acceptance ├── tools │ └── pkg.go └── openstack │ ├── db │ └── v1 │ │ └── pkg.go │ ├── identity │ ├── v2 │ │ └── pkg.go │ └── v3 │ │ └── pkg.go │ ├── networking │ └── v2 │ │ ├── pkg.go │ │ └── extensions │ │ ├── fwaas │ │ └── pkg.go │ │ ├── lbaas │ │ └── pkg.go │ │ ├── pkg.go │ │ ├── lbaas_v2 │ │ └── pkg.go │ │ └── portsbinding │ │ └── pkg.go │ ├── objectstorage │ └── v1 │ │ └── pkg.go │ ├── orchestration │ └── v1 │ │ ├── pkg.go │ │ ├── hello-compute.json │ │ └── buildinfo_test.go │ ├── pkg.go │ ├── blockstorage │ ├── v1 │ │ └── pkg.go │ ├── v2 │ │ └── pkg.go │ ├── v3 │ │ └── pkg.go │ ├── noauth │ │ └── pkg.go │ └── extensions │ │ └── pkg.go │ ├── compute │ └── v2 │ │ └── pkg.go │ ├── sharedfilesystems │ └── v2 │ │ ├── pkg.go │ │ └── shares_test.go │ └── common.go ├── openstack ├── vpc │ ├── v1 │ │ ├── vpcs │ │ │ ├── doc.go │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── ports │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── publicips │ │ │ ├── doc.go │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── quotas │ │ │ ├── testing │ │ │ │ ├── doc.go │ │ │ │ └── requests_test.go │ │ │ ├── urls.go │ │ │ ├── doc.go │ │ │ └── requests.go │ │ ├── bandwidths │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── urls.go │ │ │ └── doc.go │ │ ├── privateips │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── subnets │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── security │ │ │ └── groups │ │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ ├── securitygroups │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ └── securitygrouprules │ │ │ ├── testing │ │ │ └── doc.go │ │ │ └── urls.go │ └── v2.0 │ │ ├── publicips │ │ ├── testing │ │ │ └── doc.go │ │ └── urls.go │ │ ├── bandwidths │ │ ├── testing │ │ │ └── doc.go │ │ └── urls.go │ │ └── routes │ │ └── urls.go ├── ims │ └── v2 │ │ └── cloudimages │ │ ├── testing │ │ └── doc.go │ │ └── urls.go ├── testing │ └── doc.go ├── utils │ └── testing │ │ └── doc.go ├── cdn │ └── v1 │ │ ├── base │ │ ├── testing │ │ │ └── doc.go │ │ ├── doc.go │ │ ├── urls.go │ │ ├── requests.go │ │ └── results.go │ │ ├── flavors │ │ ├── testing │ │ │ └── doc.go │ │ ├── doc.go │ │ ├── urls.go │ │ └── requests.go │ │ ├── services │ │ ├── testing │ │ │ └── doc.go │ │ ├── errors.go │ │ ├── doc.go │ │ └── urls.go │ │ └── serviceassets │ │ ├── testing │ │ ├── doc.go │ │ ├── requests_test.go │ │ └── fixtures.go │ │ ├── urls.go │ │ ├── results.go │ │ └── doc.go ├── compute │ └── v2 │ │ ├── extensions │ │ ├── resetstate │ │ │ ├── testing │ │ │ │ ├── doc.go │ │ │ │ ├── fixtures.go │ │ │ │ └── requests_test.go │ │ │ ├── urls.go │ │ │ ├── results.go │ │ │ ├── doc.go │ │ │ └── requests.go │ │ ├── testing │ │ │ └── doc.go │ │ ├── keypairs │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── networks │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── urls.go │ │ │ ├── doc.go │ │ │ └── requests.go │ │ ├── defsecrules │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── diskconfig │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── results.go │ │ ├── floatingips │ │ │ └── testing │ │ │ │ └── doc.go │ │ ├── lockunlock │ │ │ ├── testing │ │ │ │ ├── doc.go │ │ │ │ └── request_test.go │ │ │ ├── results.go │ │ │ ├── doc.go │ │ │ └── requests.go │ │ ├── quotasets │ │ │ └── testing │ │ │ │ └── doc.go │ │ ├── secgroups │ │ │ └── testing │ │ │ │ └── doc.go │ │ ├── startstop │ │ │ ├── testing │ │ │ │ ├── doc.go │ │ │ │ └── requests_test.go │ │ │ ├── results.go │ │ │ ├── doc.go │ │ │ └── requests.go │ │ ├── evacuate │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── urls.go │ │ │ ├── doc.go │ │ │ └── results.go │ │ ├── migrate │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── urls.go │ │ │ └── results.go │ │ ├── pauseunpause │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── results.go │ │ │ ├── doc.go │ │ │ └── requests.go │ │ ├── servergroups │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── suspendresume │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── results.go │ │ │ ├── doc.go │ │ │ └── requests.go │ │ ├── usage │ │ │ ├── testing │ │ │ │ ├── doc.go │ │ │ │ └── requests_test.go │ │ │ ├── urls.go │ │ │ └── doc.go │ │ ├── volumeattach │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── doc.go │ │ ├── attachinterfaces │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── bootfromvolume │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── urls.go │ │ │ └── results.go │ │ ├── schedulerhints │ │ │ └── testing │ │ │ │ └── doc.go │ │ ├── tenantnetworks │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── urls.go │ │ │ ├── requests.go │ │ │ └── doc.go │ │ ├── availabilityzones │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── urls.go │ │ │ └── requests.go │ │ ├── doc.go │ │ ├── services │ │ │ ├── urls.go │ │ │ ├── requests.go │ │ │ └── doc.go │ │ ├── limits │ │ │ ├── urls.go │ │ │ ├── doc.go │ │ │ └── testing │ │ │ │ └── requests_test.go │ │ ├── hypervisors │ │ │ └── urls.go │ │ ├── extendedstatus │ │ │ └── doc.go │ │ └── aggregates │ │ │ └── urls.go │ │ ├── images │ │ ├── testing │ │ │ └── doc.go │ │ └── urls.go │ │ ├── flavors │ │ └── testing │ │ │ └── doc.go │ │ └── servers │ │ ├── testing │ │ └── doc.go │ │ └── util.go ├── db │ └── v1 │ │ ├── users │ │ ├── testing │ │ │ └── doc.go │ │ ├── doc.go │ │ └── urls.go │ │ ├── databases │ │ ├── testing │ │ │ └── doc.go │ │ ├── doc.go │ │ └── urls.go │ │ ├── flavors │ │ ├── testing │ │ │ └── doc.go │ │ ├── urls.go │ │ ├── doc.go │ │ └── requests.go │ │ ├── instances │ │ ├── testing │ │ │ └── doc.go │ │ ├── doc.go │ │ └── urls.go │ │ ├── datastores │ │ ├── testing │ │ │ └── doc.go │ │ ├── doc.go │ │ └── urls.go │ │ └── configurations │ │ ├── testing │ │ └── doc.go │ │ └── doc.go ├── ecs │ ├── v1 │ │ ├── job │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── urls.go │ │ │ └── requests.go │ │ ├── flavor │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── nics │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ └── cloudserversext │ │ │ └── results.go │ ├── v1_1 │ │ └── cloudservers │ │ │ └── urls.go │ └── v2 │ │ └── cloudservers │ │ └── urls.go ├── dns │ └── v2 │ │ ├── zones │ │ └── testing │ │ │ └── doc.go │ │ └── recordsets │ │ ├── testing │ │ └── doc.go │ │ └── urls.go ├── networking │ └── v2 │ │ ├── extensions │ │ ├── lbaas_v2 │ │ │ ├── policies │ │ │ │ ├── doc.go │ │ │ │ └── testing │ │ │ │ │ └── doc.go │ │ │ ├── whitelist │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ ├── certificates │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ ├── pools │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ ├── listeners │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ ├── monitors │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ ├── loadbalancers │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ └── doc.go │ │ ├── testing │ │ │ └── doc.go │ │ ├── lbaas │ │ │ ├── vips │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ ├── pools │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ ├── members │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ ├── monitors │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ └── doc.go │ │ ├── external │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── results.go │ │ ├── fwaas │ │ │ ├── rules │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ ├── errors.go │ │ │ │ └── urls.go │ │ │ ├── firewalls │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ ├── errors.go │ │ │ │ └── urls.go │ │ │ ├── policies │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ ├── routerinsertion │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── results.go │ │ │ └── doc.go │ │ ├── provider │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── requests.go │ │ ├── security │ │ │ ├── rules │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ └── groups │ │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ ├── layer3 │ │ │ ├── routers │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ ├── floatingips │ │ │ │ ├── testing │ │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ └── doc.go │ │ ├── subnetpools │ │ │ └── testing │ │ │ │ └── doc.go │ │ ├── portsbinding │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── doc.go │ │ └── portsecurity │ │ │ └── results.go │ │ ├── ports │ │ ├── testing │ │ │ └── doc.go │ │ └── urls.go │ │ ├── subnets │ │ ├── testing │ │ │ └── doc.go │ │ └── urls.go │ │ ├── networks │ │ └── testing │ │ │ └── doc.go │ │ ├── apiversions │ │ ├── testing │ │ │ └── doc.go │ │ ├── urls.go │ │ └── doc.go │ │ └── common │ │ └── common_tests.go ├── blockstorage │ ├── v2 │ │ ├── volumes │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── util.go │ │ ├── snapshots │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── util.go │ │ └── extensions │ │ │ ├── volumetypes │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ │ ├── apiversions │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── urls.go │ │ │ └── requests.go │ │ │ ├── extensions │ │ │ ├── testing │ │ │ │ ├── doc.go │ │ │ │ └── requests_test.go │ │ │ ├── urls.go │ │ │ └── requests.go │ │ │ └── availabilityzones │ │ │ ├── testing │ │ │ ├── doc.go │ │ │ └── requests_test.go │ │ │ ├── urls.go │ │ │ └── requests.go │ ├── v3 │ │ ├── volumes │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── doc.go │ │ │ ├── util.go │ │ │ └── urls.go │ │ ├── snapshots │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── doc.go │ │ │ ├── util.go │ │ │ └── urls.go │ │ └── volumetypes │ │ │ ├── testing │ │ │ └── doc.go │ │ │ └── urls.go │ ├── noauth │ │ ├── testing │ │ │ ├── doc.go │ │ │ └── fixtures.go │ │ └── doc.go │ ├── v1 │ │ ├── snapshots │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── doc.go │ │ │ ├── util.go │ │ │ └── urls.go │ │ ├── apiversions │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── doc.go │ │ │ ├── urls.go │ │ │ └── requests.go │ │ ├── volumetypes │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ ├── urls.go │ │ │ └── doc.go │ │ └── volumes │ │ │ ├── doc.go │ │ │ ├── testing │ │ │ └── doc.go │ │ │ ├── urls.go │ │ │ └── util.go │ └── extensions │ │ ├── volumeactions │ │ ├── testing │ │ │ └── doc.go │ │ └── urls.go │ │ ├── services │ │ ├── urls.go │ │ └── doc.go │ │ ├── schedulerstats │ │ ├── urls.go │ │ └── doc.go │ │ └── volumetenants │ │ ├── results.go │ │ └── doc.go ├── ces │ └── v1 │ │ ├── metrics │ │ ├── testing │ │ │ ├── doc.go │ │ │ └── fixtures.go │ │ └── urls.go │ │ ├── metricdata │ │ ├── testing │ │ │ └── doc.go │ │ └── urls.go │ │ ├── quotas │ │ ├── urls.go │ │ ├── requests.go │ │ └── results.go │ │ ├── events │ │ ├── urls.go │ │ └── results.go │ │ └── alarms │ │ └── urls.go ├── identity │ ├── v2 │ │ ├── tokens │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── users │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ ├── tenants │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ └── urls.go │ │ └── extensions │ │ │ ├── testing │ │ │ └── doc.go │ │ │ ├── admin │ │ │ └── roles │ │ │ │ ├── testing │ │ │ │ └── doc.go │ │ │ │ └── urls.go │ │ │ └── doc.go │ └── v3 │ │ ├── roles │ │ └── testing │ │ │ └── doc.go │ │ ├── tokens │ │ └── testing │ │ │ └── doc.go │ │ ├── services │ │ ├── testing │ │ │ └── doc.go │ │ └── urls.go │ │ ├── endpoints │ │ ├── testing │ │ │ └── doc.go │ │ └── urls.go │ │ └── extensions │ │ └── trusts │ │ ├── testing │ │ └── doc.go │ │ └── doc.go ├── imageservice │ └── v2 │ │ ├── images │ │ └── testing │ │ │ └── doc.go │ │ ├── imagedata │ │ ├── testing │ │ │ └── doc.go │ │ ├── urls.go │ │ ├── doc.go │ │ ├── results.go │ │ └── requests.go │ │ ├── members │ │ └── testing │ │ │ └── doc.go │ │ └── README.md ├── objectstorage │ └── v1 │ │ ├── swauth │ │ ├── testing │ │ │ ├── doc.go │ │ │ └── requests_test.go │ │ ├── urls.go │ │ └── doc.go │ │ ├── accounts │ │ ├── testing │ │ │ └── doc.go │ │ └── urls.go │ │ ├── objects │ │ ├── testing │ │ │ └── doc.go │ │ └── errors.go │ │ └── containers │ │ ├── testing │ │ └── doc.go │ │ └── urls.go ├── common │ └── extensions │ │ ├── testing │ │ └── doc.go │ │ ├── urls.go │ │ └── requests.go ├── sharedfilesystems │ ├── apiversions │ │ ├── testing │ │ │ └── doc.go │ │ ├── doc.go │ │ ├── urls.go │ │ ├── errors.go │ │ └── requests.go │ └── v2 │ │ ├── availabilityzones │ │ ├── urls.go │ │ └── requests.go │ │ ├── securityservices │ │ └── urls.go │ │ └── shares │ │ └── urls.go ├── orchestration │ └── v1 │ │ ├── stacks │ │ ├── testing │ │ │ └── doc.go │ │ ├── doc.go │ │ └── errors.go │ │ ├── buildinfo │ │ ├── testing │ │ │ ├── doc.go │ │ │ └── requests_test.go │ │ ├── doc.go │ │ ├── urls.go │ │ ├── requests.go │ │ └── results.go │ │ ├── apiversions │ │ ├── testing │ │ │ └── doc.go │ │ ├── urls.go │ │ ├── doc.go │ │ └── requests.go │ │ ├── stackevents │ │ ├── testing │ │ │ └── doc.go │ │ ├── doc.go │ │ └── urls.go │ │ ├── stackresources │ │ ├── testing │ │ │ └── doc.go │ │ └── doc.go │ │ └── stacktemplates │ │ ├── testing │ │ └── doc.go │ │ ├── urls.go │ │ └── doc.go ├── rds │ └── v3 │ │ ├── flavors │ │ └── urls.go │ │ ├── datastores │ │ ├── urls.go │ │ ├── requests.go │ │ └── results.go │ │ ├── storagetype │ │ └── urls.go │ │ ├── configurations │ │ └── urls.go │ │ ├── db_privilege │ │ ├── urls.go │ │ └── results.go │ │ ├── db_user │ │ └── urls.go │ │ └── database │ │ └── urls.go ├── bss │ └── v1 │ │ ├── resource │ │ └── urls.go │ │ ├── account │ │ └── urls.go │ │ ├── enquiry │ │ └── urls.go │ │ ├── utilities │ │ ├── urls.go │ │ └── results.go │ │ ├── payperuseresource │ │ └── urls.go │ │ └── customermanagement │ │ └── url.go ├── as │ ├── v1 │ │ ├── logs │ │ │ └── urls.go │ │ ├── policylogs │ │ │ └── urls.go │ │ ├── quotas │ │ │ ├── urls.go │ │ │ └── requests.go │ │ ├── instances │ │ │ └── urls.go │ │ ├── notifications │ │ │ └── urls.go │ │ ├── tags │ │ │ └── urls.go │ │ └── configures │ │ │ └── urls.go │ └── v2 │ │ └── policies │ │ └── urls.go ├── bssintl │ └── v1 │ │ ├── enquiry │ │ └── urls.go │ │ ├── utilities │ │ ├── urls.go │ │ └── results.go │ │ ├── payperuseresource │ │ └── urls.go │ │ └── customercredit │ │ └── urls.go ├── iam │ └── v3 │ │ ├── projects │ │ └── urls.go │ │ └── users │ │ └── urls.go └── tms │ └── v1 │ └── predefinetags │ ├── urls.go │ └── results.go ├── testing ├── doc.go └── endpoint_search_test.go ├── pagination ├── testing │ ├── doc.go │ └── pagination_test.go └── pkg.go ├── script ├── cibuild ├── unittest ├── test ├── acceptancetest ├── coverage ├── format └── bootstrap ├── testhelper ├── doc.go ├── client │ └── fake.go └── fixture │ └── helper.go ├── README.md ├── auth └── base_options.go ├── functiontest └── fgs │ └── Common │ └── common.go └── codex_go.sh /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /internal/pkg.go: -------------------------------------------------------------------------------- 1 | package internal 2 | -------------------------------------------------------------------------------- /acceptance/tools/pkg.go: -------------------------------------------------------------------------------- 1 | package tools 2 | -------------------------------------------------------------------------------- /internal/testing/pkg.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/vpc/v1/vpcs/doc.go: -------------------------------------------------------------------------------- 1 | package vpcs -------------------------------------------------------------------------------- /acceptance/openstack/db/v1/pkg.go: -------------------------------------------------------------------------------- 1 | package v1 2 | -------------------------------------------------------------------------------- /testing/doc.go: -------------------------------------------------------------------------------- 1 | // gophercloud 2 | package testing 3 | -------------------------------------------------------------------------------- /acceptance/openstack/identity/v2/pkg.go: -------------------------------------------------------------------------------- 1 | package v2 2 | -------------------------------------------------------------------------------- /acceptance/openstack/identity/v3/pkg.go: -------------------------------------------------------------------------------- 1 | package v3 2 | -------------------------------------------------------------------------------- /acceptance/openstack/networking/v2/pkg.go: -------------------------------------------------------------------------------- 1 | package v2 2 | -------------------------------------------------------------------------------- /openstack/vpc/v1/ports/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/vpc/v1/publicips/doc.go: -------------------------------------------------------------------------------- 1 | package publicips 2 | -------------------------------------------------------------------------------- /openstack/vpc/v1/quotas/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/vpc/v1/vpcs/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /acceptance/openstack/objectstorage/v1/pkg.go: -------------------------------------------------------------------------------- 1 | package v1 2 | -------------------------------------------------------------------------------- /acceptance/openstack/orchestration/v1/pkg.go: -------------------------------------------------------------------------------- 1 | package v1 2 | -------------------------------------------------------------------------------- /openstack/ims/v2/cloudimages/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/testing/doc.go: -------------------------------------------------------------------------------- 1 | // openstack 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/utils/testing/doc.go: -------------------------------------------------------------------------------- 1 | //utils 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/vpc/v1/bandwidths/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/vpc/v1/privateips/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/vpc/v1/publicips/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/vpc/v1/subnets/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/vpc/v2.0/publicips/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /pagination/testing/doc.go: -------------------------------------------------------------------------------- 1 | // pagination 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/vpc/v1/security/groups/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/vpc/v1/securitygroups/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/vpc/v2.0/bandwidths/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/vpc/v1/securitygrouprules/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /acceptance/openstack/networking/v2/extensions/fwaas/pkg.go: -------------------------------------------------------------------------------- 1 | package fwaas 2 | -------------------------------------------------------------------------------- /acceptance/openstack/networking/v2/extensions/lbaas/pkg.go: -------------------------------------------------------------------------------- 1 | package lbaas 2 | -------------------------------------------------------------------------------- /acceptance/openstack/networking/v2/extensions/pkg.go: -------------------------------------------------------------------------------- 1 | package extensions 2 | -------------------------------------------------------------------------------- /openstack/cdn/v1/base/testing/doc.go: -------------------------------------------------------------------------------- 1 | // cdn_base_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/resetstate/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/db/v1/users/testing/doc.go: -------------------------------------------------------------------------------- 1 | // db_users_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/ecs/v1/job/testing/doc.go: -------------------------------------------------------------------------------- 1 | // job unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /acceptance/openstack/networking/v2/extensions/lbaas_v2/pkg.go: -------------------------------------------------------------------------------- 1 | package lbaas_v2 2 | -------------------------------------------------------------------------------- /acceptance/openstack/pkg.go: -------------------------------------------------------------------------------- 1 | // +build acceptance 2 | 3 | package openstack 4 | -------------------------------------------------------------------------------- /openstack/cdn/v1/flavors/testing/doc.go: -------------------------------------------------------------------------------- 1 | // cdn_flavors_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/cdn/v1/services/testing/doc.go: -------------------------------------------------------------------------------- 1 | // cdn_services_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/db/v1/databases/testing/doc.go: -------------------------------------------------------------------------------- 1 | // db_databases_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/db/v1/flavors/testing/doc.go: -------------------------------------------------------------------------------- 1 | // db_flavors_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/db/v1/instances/testing/doc.go: -------------------------------------------------------------------------------- 1 | // db_instances_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/dns/v2/zones/testing/doc.go: -------------------------------------------------------------------------------- 1 | // zones unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/ecs/v1/flavor/testing/doc.go: -------------------------------------------------------------------------------- 1 | // flavor unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/ecs/v1/nics/testing/doc.go: -------------------------------------------------------------------------------- 1 | // nics unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/policies/doc.go: -------------------------------------------------------------------------------- 1 | package policies 2 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/volumes/testing/doc.go: -------------------------------------------------------------------------------- 1 | // volumes_v2 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/blockstorage/v3/volumes/testing/doc.go: -------------------------------------------------------------------------------- 1 | // volumes_v3 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/ces/v1/metrics/testing/doc.go: -------------------------------------------------------------------------------- 1 | // metrics unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/images/testing/doc.go: -------------------------------------------------------------------------------- 1 | // images unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/db/v1/datastores/testing/doc.go: -------------------------------------------------------------------------------- 1 | // db_datastores_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/identity/v2/tokens/testing/doc.go: -------------------------------------------------------------------------------- 1 | // tokens unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/identity/v2/users/testing/doc.go: -------------------------------------------------------------------------------- 1 | // users unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/identity/v3/roles/testing/doc.go: -------------------------------------------------------------------------------- 1 | // roles unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/identity/v3/tokens/testing/doc.go: -------------------------------------------------------------------------------- 1 | // tokens unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/policies/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/whitelist/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/networking/v2/ports/testing/doc.go: -------------------------------------------------------------------------------- 1 | // ports unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /acceptance/openstack/networking/v2/extensions/portsbinding/pkg.go: -------------------------------------------------------------------------------- 1 | package portsbinding 2 | -------------------------------------------------------------------------------- /openstack/blockstorage/noauth/testing/doc.go: -------------------------------------------------------------------------------- 1 | // noauth unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/snapshots/testing/doc.go: -------------------------------------------------------------------------------- 1 | // snapshots_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/snapshots/testing/doc.go: -------------------------------------------------------------------------------- 1 | // snapshots_v2 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/blockstorage/v3/snapshots/testing/doc.go: -------------------------------------------------------------------------------- 1 | // snapshots_v3 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/blockstorage/v3/volumetypes/testing/doc.go: -------------------------------------------------------------------------------- 1 | // volume_types 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/cdn/v1/serviceassets/testing/doc.go: -------------------------------------------------------------------------------- 1 | // cdn_serviceassets_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/ces/v1/metricdata/testing/doc.go: -------------------------------------------------------------------------------- 1 | // metricdata unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/flavors/testing/doc.go: -------------------------------------------------------------------------------- 1 | // flavors unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/servers/testing/doc.go: -------------------------------------------------------------------------------- 1 | // servers unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/db/v1/configurations/testing/doc.go: -------------------------------------------------------------------------------- 1 | // db_configurations_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/dns/v2/recordsets/testing/doc.go: -------------------------------------------------------------------------------- 1 | // recordsets unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/identity/v2/tenants/testing/doc.go: -------------------------------------------------------------------------------- 1 | // tenants unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/identity/v3/services/testing/doc.go: -------------------------------------------------------------------------------- 1 | // services unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/imageservice/v2/images/testing/doc.go: -------------------------------------------------------------------------------- 1 | // images unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/certificates/testing/doc.go: -------------------------------------------------------------------------------- 1 | package testing 2 | -------------------------------------------------------------------------------- /openstack/networking/v2/subnets/testing/doc.go: -------------------------------------------------------------------------------- 1 | // subnets unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/objectstorage/v1/swauth/testing/doc.go: -------------------------------------------------------------------------------- 1 | // swauth unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/apiversions/testing/doc.go: -------------------------------------------------------------------------------- 1 | // apiversions_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/volumetypes/testing/doc.go: -------------------------------------------------------------------------------- 1 | // volumetypes_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/common/extensions/testing/doc.go: -------------------------------------------------------------------------------- 1 | // common extensions unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/testing/doc.go: -------------------------------------------------------------------------------- 1 | // extensions unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/identity/v2/extensions/testing/doc.go: -------------------------------------------------------------------------------- 1 | // extensions unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/identity/v3/endpoints/testing/doc.go: -------------------------------------------------------------------------------- 1 | // endpoints unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/imageservice/v2/imagedata/testing/doc.go: -------------------------------------------------------------------------------- 1 | // imagedata unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/imageservice/v2/members/testing/doc.go: -------------------------------------------------------------------------------- 1 | // members unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/testing/doc.go: -------------------------------------------------------------------------------- 1 | // extensions unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/networks/testing/doc.go: -------------------------------------------------------------------------------- 1 | // networks unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/objectstorage/v1/accounts/testing/doc.go: -------------------------------------------------------------------------------- 1 | // accounts unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/objectstorage/v1/objects/testing/doc.go: -------------------------------------------------------------------------------- 1 | // objects unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/sharedfilesystems/apiversions/testing/doc.go: -------------------------------------------------------------------------------- 1 | // apiversions_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/volumetypes/testing/doc.go: -------------------------------------------------------------------------------- 1 | // volume_types 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/keypairs/testing/doc.go: -------------------------------------------------------------------------------- 1 | // keypairs unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/networks/testing/doc.go: -------------------------------------------------------------------------------- 1 | // networks unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/identity/v2/extensions/admin/roles/testing/doc.go: -------------------------------------------------------------------------------- 1 | // roles unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/identity/v3/extensions/trusts/testing/doc.go: -------------------------------------------------------------------------------- 1 | // trusts unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/apiversions/testing/doc.go: -------------------------------------------------------------------------------- 1 | // apiversions unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas/vips/testing/doc.go: -------------------------------------------------------------------------------- 1 | // vips unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/objectstorage/v1/containers/testing/doc.go: -------------------------------------------------------------------------------- 1 | // containers unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/stacks/testing/doc.go: -------------------------------------------------------------------------------- 1 | // orchestration_stacks_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/apiversions/testing/doc.go: -------------------------------------------------------------------------------- 1 | // apiversions_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/defsecrules/testing/doc.go: -------------------------------------------------------------------------------- 1 | // defsecrules unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/diskconfig/testing/doc.go: -------------------------------------------------------------------------------- 1 | // diskconfig unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/floatingips/testing/doc.go: -------------------------------------------------------------------------------- 1 | // floatingips unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/lockunlock/testing/doc.go: -------------------------------------------------------------------------------- 1 | // unlocklock unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/quotasets/testing/doc.go: -------------------------------------------------------------------------------- 1 | // quotasets unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/secgroups/testing/doc.go: -------------------------------------------------------------------------------- 1 | // secgroups unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/startstop/testing/doc.go: -------------------------------------------------------------------------------- 1 | // startstop unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/external/testing/doc.go: -------------------------------------------------------------------------------- 1 | // external unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/fwaas/rules/testing/doc.go: -------------------------------------------------------------------------------- 1 | // rules unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas/pools/testing/doc.go: -------------------------------------------------------------------------------- 1 | // pools unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/pools/testing/doc.go: -------------------------------------------------------------------------------- 1 | // pools unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/provider/testing/doc.go: -------------------------------------------------------------------------------- 1 | // provider unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/security/rules/testing/doc.go: -------------------------------------------------------------------------------- 1 | // rules unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/buildinfo/testing/doc.go: -------------------------------------------------------------------------------- 1 | // orchestration_buildinfo_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/evacuate/testing/doc.go: -------------------------------------------------------------------------------- 1 | // compute_extensions_evacuate_v2 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/migrate/testing/doc.go: -------------------------------------------------------------------------------- 1 | // compute_extensions_startstop_v2 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/pauseunpause/testing/doc.go: -------------------------------------------------------------------------------- 1 | // pauseunpause unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/servergroups/testing/doc.go: -------------------------------------------------------------------------------- 1 | // servergroups unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/suspendresume/testing/doc.go: -------------------------------------------------------------------------------- 1 | // suspendresume unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/usage/testing/doc.go: -------------------------------------------------------------------------------- 1 | // simple tenant usage unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/volumeattach/testing/doc.go: -------------------------------------------------------------------------------- 1 | // volumeattach unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/fwaas/firewalls/testing/doc.go: -------------------------------------------------------------------------------- 1 | // firewalls unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/fwaas/policies/testing/doc.go: -------------------------------------------------------------------------------- 1 | // policies unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/layer3/routers/testing/doc.go: -------------------------------------------------------------------------------- 1 | // routers unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas/members/testing/doc.go: -------------------------------------------------------------------------------- 1 | // members unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas/monitors/testing/doc.go: -------------------------------------------------------------------------------- 1 | // monitors unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/security/groups/testing/doc.go: -------------------------------------------------------------------------------- 1 | // groups unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/subnetpools/testing/doc.go: -------------------------------------------------------------------------------- 1 | // subnetpools unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/apiversions/testing/doc.go: -------------------------------------------------------------------------------- 1 | // orchestration_apiversions_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/stackevents/testing/doc.go: -------------------------------------------------------------------------------- 1 | // orchestration_stackevents_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /script/cibuild: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Test script to be invoked by Travis. 4 | 5 | exec script/unittest -v 6 | -------------------------------------------------------------------------------- /script/unittest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Run the unit tests. 4 | 5 | exec go test ./testing ./.../testing $@ 6 | -------------------------------------------------------------------------------- /openstack/blockstorage/extensions/volumeactions/testing/doc.go: -------------------------------------------------------------------------------- 1 | // volumeactions unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/extensions/testing/doc.go: -------------------------------------------------------------------------------- 1 | // common extensions unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/attachinterfaces/testing/doc.go: -------------------------------------------------------------------------------- 1 | // attachinterfaces unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/bootfromvolume/testing/doc.go: -------------------------------------------------------------------------------- 1 | // bootfromvolume unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/schedulerhints/testing/doc.go: -------------------------------------------------------------------------------- 1 | // schedulerhints unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/tenantnetworks/testing/doc.go: -------------------------------------------------------------------------------- 1 | // tenantnetworks unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/layer3/floatingips/testing/doc.go: -------------------------------------------------------------------------------- 1 | // floatingips unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/listeners/testing/doc.go: -------------------------------------------------------------------------------- 1 | // listeners unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/monitors/testing/doc.go: -------------------------------------------------------------------------------- 1 | // monitors unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/portsbinding/testing/doc.go: -------------------------------------------------------------------------------- 1 | // portsbindings unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/stackresources/testing/doc.go: -------------------------------------------------------------------------------- 1 | // orchestration_stackresources_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/stacktemplates/testing/doc.go: -------------------------------------------------------------------------------- 1 | // orchestration_stacktemplates_v1 2 | package testing 3 | -------------------------------------------------------------------------------- /script/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Run all the tests. 4 | 5 | exec go test -tags 'acceptance fixtures' ./... $@ 6 | -------------------------------------------------------------------------------- /acceptance/openstack/blockstorage/v1/pkg.go: -------------------------------------------------------------------------------- 1 | // Package v1 contains openstack cinder acceptance tests 2 | package v1 3 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/availabilityzones/testing/doc.go: -------------------------------------------------------------------------------- 1 | // availabilityzones unittests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/availabilityzones/testing/doc.go: -------------------------------------------------------------------------------- 1 | // availabilityzones unittests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/fwaas/routerinsertion/testing/doc.go: -------------------------------------------------------------------------------- 1 | // routerinsertion unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/loadbalancers/testing/doc.go: -------------------------------------------------------------------------------- 1 | // loadbalancers unit tests 2 | package testing 3 | -------------------------------------------------------------------------------- /testhelper/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package testhelper container methods that are useful for writing unit tests. 3 | */ 4 | package testhelper 5 | -------------------------------------------------------------------------------- /acceptance/openstack/compute/v2/pkg.go: -------------------------------------------------------------------------------- 1 | // Package v2 package contains acceptance tests for the Openstack Compute V2 service. 2 | package v2 3 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/buildinfo/doc.go: -------------------------------------------------------------------------------- 1 | // Package buildinfo provides build information about heat deployments. 2 | package buildinfo 3 | -------------------------------------------------------------------------------- /acceptance/openstack/blockstorage/v2/pkg.go: -------------------------------------------------------------------------------- 1 | // The v2 package contains acceptance tests for the Openstack Cinder V2 service. 2 | 3 | package v2 4 | -------------------------------------------------------------------------------- /acceptance/openstack/blockstorage/v3/pkg.go: -------------------------------------------------------------------------------- 1 | // The v3 package contains acceptance tests for the OpenStack Cinder V3 service. 2 | 3 | package v3 4 | -------------------------------------------------------------------------------- /acceptance/openstack/sharedfilesystems/v2/pkg.go: -------------------------------------------------------------------------------- 1 | // The v2 package contains acceptance tests for the Openstack Manila V2 service. 2 | 3 | package v2 4 | -------------------------------------------------------------------------------- /script/acceptancetest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Run the acceptance tests. 4 | 5 | exec go test -p=1 github.com/gophercloud/gophercloud/acceptance/... $@ 6 | -------------------------------------------------------------------------------- /acceptance/openstack/blockstorage/noauth/pkg.go: -------------------------------------------------------------------------------- 1 | // The noauth package contains acceptance tests for the Openstack Cinder standalone service. 2 | 3 | package noauth 4 | -------------------------------------------------------------------------------- /openstack/db/v1/users/doc.go: -------------------------------------------------------------------------------- 1 | // Package users provides information and interaction with the user API 2 | // resource in the OpenStack Database service. 3 | package users 4 | -------------------------------------------------------------------------------- /acceptance/openstack/blockstorage/extensions/pkg.go: -------------------------------------------------------------------------------- 1 | // The extensions package contains acceptance tests for the Openstack Cinder extensions service. 2 | 3 | package extensions 4 | -------------------------------------------------------------------------------- /pagination/pkg.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package pagination contains utilities and convenience structs that implement common pagination idioms within OpenStack APIs. 3 | */ 4 | package pagination 5 | -------------------------------------------------------------------------------- /openstack/cdn/v1/services/errors.go: -------------------------------------------------------------------------------- 1 | package services 2 | 3 | import "fmt" 4 | 5 | func no(str string) error { 6 | return fmt.Errorf("Required parameter %s not provided", str) 7 | } 8 | -------------------------------------------------------------------------------- /openstack/db/v1/datastores/doc.go: -------------------------------------------------------------------------------- 1 | // Package datastores provides information and interaction with the datastore 2 | // API resource in the Rackspace Database service. 3 | package datastores 4 | -------------------------------------------------------------------------------- /openstack/imageservice/v2/README.md: -------------------------------------------------------------------------------- 1 | This provides a Go API which wraps any service implementing the [OpenStack Image Service API, version 2](http://developer.openstack.org/api-ref-image-v2.html). 2 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/doc.go: -------------------------------------------------------------------------------- 1 | // Package extensions provides information and interaction with the 2 | // different extensions available for the OpenStack Compute service. 3 | package extensions 4 | -------------------------------------------------------------------------------- /openstack/identity/v2/extensions/doc.go: -------------------------------------------------------------------------------- 1 | // Package extensions provides information and interaction with the 2 | // different extensions available for the OpenStack Identity service. 3 | package extensions 4 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/fwaas/doc.go: -------------------------------------------------------------------------------- 1 | // Package fwaas provides information and interaction with the Firewall 2 | // as a Service extension for the OpenStack Networking service. 3 | package fwaas 4 | -------------------------------------------------------------------------------- /openstack/vpc/v2.0/publicips/urls.go: -------------------------------------------------------------------------------- 1 | package publicips 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func CreateURL(c *gophercloud.ServiceClient)string{ 6 | return c.ServiceURL("publicips") 7 | } -------------------------------------------------------------------------------- /openstack/ces/v1/metrics/urls.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func getMetricsURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("metrics") 7 | } 8 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas/doc.go: -------------------------------------------------------------------------------- 1 | // Package lbaas provides information and interaction with the Load Balancer 2 | // as a Service extension for the OpenStack Networking service. 3 | package lbaas 4 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/portsbinding/doc.go: -------------------------------------------------------------------------------- 1 | // Package portsbinding provides information and interaction with the port 2 | // binding extension for the OpenStack Networking service. 3 | package portsbinding 4 | -------------------------------------------------------------------------------- /openstack/objectstorage/v1/swauth/urls.go: -------------------------------------------------------------------------------- 1 | package swauth 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func getURL(c *gophercloud.ProviderClient) string { 6 | return c.IdentityBase + "auth/v1.0" 7 | } 8 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/apiversions/urls.go: -------------------------------------------------------------------------------- 1 | package apiversions 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func apiVersionsURL(c *gophercloud.ServiceClient) string { 6 | return c.Endpoint 7 | } 8 | -------------------------------------------------------------------------------- /openstack/ces/v1/quotas/urls.go: -------------------------------------------------------------------------------- 1 | package quotas 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func getURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("quotas") 9 | } 10 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/doc.go: -------------------------------------------------------------------------------- 1 | // Package lbaas_v2 provides information and interaction with the Load Balancer 2 | // as a Service v2 extension for the OpenStack Networking service. 3 | package lbaas_v2 4 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/buildinfo/urls.go: -------------------------------------------------------------------------------- 1 | package buildinfo 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func getURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("build_info") 7 | } 8 | -------------------------------------------------------------------------------- /openstack/sharedfilesystems/apiversions/doc.go: -------------------------------------------------------------------------------- 1 | // Package apiversions provides information and interaction with the different 2 | // API versions for the Shared File System service, code-named Manila. 3 | package apiversions 4 | -------------------------------------------------------------------------------- /openstack/vpc/v1/quotas/urls.go: -------------------------------------------------------------------------------- 1 | package quotas 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func ListURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("quotas") 9 | } 10 | -------------------------------------------------------------------------------- /openstack/blockstorage/extensions/services/urls.go: -------------------------------------------------------------------------------- 1 | package services 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("os-services") 7 | } 8 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/apiversions/doc.go: -------------------------------------------------------------------------------- 1 | // Package apiversions provides information and interaction with the different 2 | // API versions for the OpenStack Block Storage service, code-named Cinder. 3 | package apiversions 4 | -------------------------------------------------------------------------------- /openstack/ces/v1/events/urls.go: -------------------------------------------------------------------------------- 1 | package events 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func createURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("events") 9 | } 10 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/services/urls.go: -------------------------------------------------------------------------------- 1 | package services 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("os-services") 7 | } 8 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/diskconfig/results.go: -------------------------------------------------------------------------------- 1 | package diskconfig 2 | 3 | type ServerDiskConfigExt struct { 4 | // DiskConfig is the disk configuration of the server. 5 | DiskConfig DiskConfig `json:"OS-DCF:diskConfig"` 6 | } 7 | -------------------------------------------------------------------------------- /openstack/cdn/v1/serviceassets/urls.go: -------------------------------------------------------------------------------- 1 | package serviceassets 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 6 | return c.ServiceURL("services", id, "assets") 7 | } 8 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/bootfromvolume/urls.go: -------------------------------------------------------------------------------- 1 | package bootfromvolume 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func createURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("os-volumes_boot") 7 | } 8 | -------------------------------------------------------------------------------- /openstack/ecs/v1/job/urls.go: -------------------------------------------------------------------------------- 1 | package job 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // Querying task statuses URL 6 | func jobURL(sc *gophercloud.ServiceClient, jobId string) string { 7 | return sc.ServiceURL("jobs", jobId) 8 | } -------------------------------------------------------------------------------- /openstack/rds/v3/flavors/urls.go: -------------------------------------------------------------------------------- 1 | package flavors 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(sc *gophercloud.ServiceClient, databasename string) string { 6 | return sc.ServiceURL("flavors", databasename) 7 | } 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Go SDK 2 | 3 | The following services' SDK are included. 4 | \- IAM 5 | \- IMS 6 | \- VPC 7 | \- ECS 8 | \- EVS 9 | \- CES 10 | \- ELB 11 | \- DNS 12 | \- AS 13 | \- BSS 14 | \- FunctionGraph 15 | \- RDS -------------------------------------------------------------------------------- /auth/base_options.go: -------------------------------------------------------------------------------- 1 | package auth 2 | 3 | // AuthOptionsProvider presents the base of an auth options implementation 4 | type AuthOptionsProvider interface { 5 | GetIdentityEndpoint() string 6 | GetProjectId() string 7 | GetDomainId() string 8 | } 9 | -------------------------------------------------------------------------------- /openstack/cdn/v1/base/doc.go: -------------------------------------------------------------------------------- 1 | // Package base provides information and interaction with the base API 2 | // resource in the OpenStack CDN service. This API resource allows for 3 | // retrieving the Home Document and pinging the root URL. 4 | package base 5 | -------------------------------------------------------------------------------- /openstack/cdn/v1/serviceassets/results.go: -------------------------------------------------------------------------------- 1 | package serviceassets 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // DeleteResult represents the result of a Delete operation. 6 | type DeleteResult struct { 7 | gophercloud.ErrResult 8 | } 9 | -------------------------------------------------------------------------------- /openstack/rds/v3/datastores/urls.go: -------------------------------------------------------------------------------- 1 | package datastores 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(sc *gophercloud.ServiceClient, databasename string) string { 6 | return sc.ServiceURL("datastores", databasename) 7 | } 8 | -------------------------------------------------------------------------------- /openstack/rds/v3/storagetype/urls.go: -------------------------------------------------------------------------------- 1 | package storagetype 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(sc *gophercloud.ServiceClient, databasename string) string { 6 | return sc.ServiceURL("storage-type", databasename) 7 | } 8 | -------------------------------------------------------------------------------- /openstack/sharedfilesystems/v2/availabilityzones/urls.go: -------------------------------------------------------------------------------- 1 | package availabilityzones 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("os-availability-zone") 7 | } 8 | -------------------------------------------------------------------------------- /openstack/blockstorage/extensions/volumeactions/urls.go: -------------------------------------------------------------------------------- 1 | package volumeactions 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func actionURL(c *gophercloud.ServiceClient, id string) string { 6 | return c.ServiceURL("volumes", id, "action") 7 | } 8 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/stackevents/doc.go: -------------------------------------------------------------------------------- 1 | // Package stackevents provides operations for finding, listing, and retrieving 2 | // stack events. Stack events are events that take place on stacks such as 3 | // updating and abandoning. 4 | package stackevents 5 | -------------------------------------------------------------------------------- /openstack/blockstorage/extensions/schedulerstats/urls.go: -------------------------------------------------------------------------------- 1 | package schedulerstats 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func storagePoolsListURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("scheduler-stats", "get_pools") 7 | } 8 | -------------------------------------------------------------------------------- /openstack/bss/v1/resource/urls.go: -------------------------------------------------------------------------------- 1 | package resource 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(client *gophercloud.ServiceClient, domainId string) string { 6 | return client.ServiceURL(domainId, "common/order-mgr/resources/detail") 7 | } 8 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/fwaas/firewalls/errors.go: -------------------------------------------------------------------------------- 1 | package firewalls 2 | 3 | import "fmt" 4 | 5 | func err(str string) error { 6 | return fmt.Errorf("%s", str) 7 | } 8 | 9 | var ( 10 | errPolicyRequired = err("A policy ID is required") 11 | ) 12 | -------------------------------------------------------------------------------- /openstack/as/v1/logs/urls.go: -------------------------------------------------------------------------------- 1 | package logs 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func ListURL(c *gophercloud.ServiceClient, scalingGroupId string) string { 8 | return c.ServiceURL("scaling_activity_log", scalingGroupId) 9 | } 10 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/apiversions/doc.go: -------------------------------------------------------------------------------- 1 | // Package apiversions provides information and interaction with the different 2 | // API versions for the OpenStack Heat service. This functionality is not 3 | // restricted to this particular version. 4 | package apiversions 5 | -------------------------------------------------------------------------------- /openstack/vpc/v1/security/groups/urls.go: -------------------------------------------------------------------------------- 1 | package groups 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const rootPath = "security-groups" 6 | 7 | func rootURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL(rootPath) 9 | } 10 | 11 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/migrate/urls.go: -------------------------------------------------------------------------------- 1 | package migrate 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func actionURL(client *gophercloud.ServiceClient, id string) string { 8 | return client.ServiceURL("servers", id, "action") 9 | } 10 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/portsecurity/results.go: -------------------------------------------------------------------------------- 1 | package portsecurity 2 | 3 | type PortSecurityExt struct { 4 | // PortSecurityEnabled specifies whether port security is enabled or 5 | // disabled. 6 | PortSecurityEnabled bool `json:"port_security_enabled"` 7 | } 8 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/evacuate/urls.go: -------------------------------------------------------------------------------- 1 | package evacuate 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func actionURL(client *gophercloud.ServiceClient, id string) string { 8 | return client.ServiceURL("servers", id, "action") 9 | } 10 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/limits/urls.go: -------------------------------------------------------------------------------- 1 | package limits 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | const resourcePath = "limits" 8 | 9 | func getURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL(resourcePath) 11 | } 12 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/resetstate/urls.go: -------------------------------------------------------------------------------- 1 | package resetstate 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func actionURL(client *gophercloud.ServiceClient, id string) string { 8 | return client.ServiceURL("servers", id, "action") 9 | } 10 | -------------------------------------------------------------------------------- /openstack/as/v1/policylogs/urls.go: -------------------------------------------------------------------------------- 1 | package policylogs 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func ListURL(c *gophercloud.ServiceClient, scalingPolicyId string) string { 8 | return c.ServiceURL("scaling_policy_execute_log", scalingPolicyId) 9 | } 10 | -------------------------------------------------------------------------------- /openstack/db/v1/databases/doc.go: -------------------------------------------------------------------------------- 1 | // Package flavors provides information and interaction with the database API 2 | // resource in the OpenStack Database service. 3 | // 4 | // A database, when referred to here, refers to the database engine running on 5 | // an instance. 6 | package databases 7 | -------------------------------------------------------------------------------- /openstack/cdn/v1/base/urls.go: -------------------------------------------------------------------------------- 1 | package base 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func getURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL() 7 | } 8 | 9 | func pingURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL("ping") 11 | } 12 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/fwaas/routerinsertion/results.go: -------------------------------------------------------------------------------- 1 | package routerinsertion 2 | 3 | // FirewallExt is an extension to the base Firewall object 4 | type FirewallExt struct { 5 | // RouterIDs are the routers that the firewall is attached to. 6 | RouterIDs []string `json:"router_ids"` 7 | } 8 | -------------------------------------------------------------------------------- /openstack/objectstorage/v1/accounts/urls.go: -------------------------------------------------------------------------------- 1 | package accounts 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func getURL(c *gophercloud.ServiceClient) string { 6 | return c.Endpoint 7 | } 8 | 9 | func updateURL(c *gophercloud.ServiceClient) string { 10 | return getURL(c) 11 | } 12 | -------------------------------------------------------------------------------- /openstack/blockstorage/extensions/volumetenants/results.go: -------------------------------------------------------------------------------- 1 | package volumetenants 2 | 3 | // VolumeTenantExt is an extension to the base Volume object 4 | type VolumeTenantExt struct { 5 | // TenantID is the id of the project that owns the volume. 6 | TenantID string `json:"os-vol-tenant-attr:tenant_id"` 7 | } 8 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/volumes/doc.go: -------------------------------------------------------------------------------- 1 | // Package volumes provides information and interaction with volumes in the 2 | // OpenStack Block Storage service. A volume is a detachable block storage 3 | // device, akin to a USB hard drive. It can only be attached to one instance at 4 | // a time. 5 | package volumes 6 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/availabilityzones/urls.go: -------------------------------------------------------------------------------- 1 | package availabilityzones 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // listURL generates URL for list avaliabilityzones 6 | func listURL(c *gophercloud.ServiceClient) string { 7 | return c.ServiceURL("os-availability-zone") 8 | } 9 | -------------------------------------------------------------------------------- /openstack/blockstorage/v3/volumes/doc.go: -------------------------------------------------------------------------------- 1 | // Package volumes provides information and interaction with volumes in the 2 | // OpenStack Block Storage service. A volume is a detachable block storage 3 | // device, akin to a USB hard drive. It can only be attached to one instance at 4 | // a time. 5 | package volumes 6 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/buildinfo/requests.go: -------------------------------------------------------------------------------- 1 | package buildinfo 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // Get retreives data for the given stack template. 6 | func Get(c *gophercloud.ServiceClient) (r GetResult) { 7 | _, r.Err = c.Get(getURL(c), &r.Body, nil) 8 | return 9 | } 10 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/extensions/urls.go: -------------------------------------------------------------------------------- 1 | package extensions 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // ListExtensionURL generates the URL for the extensions resource collection. 6 | func ListExtensionURL(c *gophercloud.ServiceClient) string { 7 | return c.ServiceURL("extensions") 8 | } 9 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/snapshots/doc.go: -------------------------------------------------------------------------------- 1 | // Package snapshots provides information and interaction with snapshots in the 2 | // OpenStack Block Storage service. A snapshot is a point in time copy of the 3 | // data contained in an external storage volume, and can be controlled 4 | // programmatically. 5 | package snapshots 6 | -------------------------------------------------------------------------------- /openstack/blockstorage/v3/snapshots/doc.go: -------------------------------------------------------------------------------- 1 | // Package snapshots provides information and interaction with snapshots in the 2 | // OpenStack Block Storage service. A snapshot is a point in time copy of the 3 | // data contained in an external storage volume, and can be controlled 4 | // programmatically. 5 | package snapshots 6 | -------------------------------------------------------------------------------- /openstack/cdn/v1/flavors/doc.go: -------------------------------------------------------------------------------- 1 | // Package flavors provides information and interaction with the flavors API 2 | // resource in the OpenStack CDN service. This API resource allows for 3 | // listing flavors and retrieving a specific flavor. 4 | // 5 | // A flavor is a mapping configuration to a CDN provider. 6 | package flavors 7 | -------------------------------------------------------------------------------- /openstack/cdn/v1/flavors/urls.go: -------------------------------------------------------------------------------- 1 | package flavors 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("flavors") 7 | } 8 | 9 | func getURL(c *gophercloud.ServiceClient, id string) string { 10 | return c.ServiceURL("flavors", id) 11 | } 12 | -------------------------------------------------------------------------------- /openstack/bss/v1/account/urls.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // /v1.0/{domain_id}/customer/account-mgr/bill/resource-daily 6 | func getURL(client *gophercloud.ServiceClient, domainId string) string { 7 | return client.ServiceURL(domainId, "customer/account-mgr/bill/resource-daily") 8 | } 9 | -------------------------------------------------------------------------------- /openstack/bss/v1/enquiry/urls.go: -------------------------------------------------------------------------------- 1 | package enquiry 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // POST /v1.0/{domain_id}/customer/product-mgr/query-rating 6 | func getQueryRatingURL(client *gophercloud.ServiceClient, domainId string) string { 7 | return client.ServiceURL(domainId, "customer/product-mgr/query-rating") 8 | } 9 | -------------------------------------------------------------------------------- /openstack/bssintl/v1/enquiry/urls.go: -------------------------------------------------------------------------------- 1 | package enquiry 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // POST /v1.0/{domain_id}/customer/product-mgr/query-rating 6 | func getQueryRatingURL(client *gophercloud.ServiceClient, domainId string) string { 7 | return client.ServiceURL(domainId, "customer/product-mgr/query-rating") 8 | } 9 | -------------------------------------------------------------------------------- /openstack/ces/v1/quotas/requests.go: -------------------------------------------------------------------------------- 1 | package quotas 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func Get(client *gophercloud.ServiceClient) (r GetResult) { 8 | _, r.Err = client.Get(getURL(client), &r.Body, &gophercloud.RequestOpts{ 9 | OkCodes: []int{200}, 10 | }) 11 | 12 | return 13 | } 14 | -------------------------------------------------------------------------------- /openstack/db/v1/flavors/urls.go: -------------------------------------------------------------------------------- 1 | package flavors 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func getURL(client *gophercloud.ServiceClient, id string) string { 6 | return client.ServiceURL("flavors", id) 7 | } 8 | 9 | func listURL(client *gophercloud.ServiceClient) string { 10 | return client.ServiceURL("flavors") 11 | } 12 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/external/results.go: -------------------------------------------------------------------------------- 1 | package external 2 | 3 | // NetworkExternalExt represents a decorated form of a Network with based on the 4 | // "external-net" extension. 5 | type NetworkExternalExt struct { 6 | // Specifies whether the network is an external network or not. 7 | External bool `json:"router:external"` 8 | } 9 | -------------------------------------------------------------------------------- /openstack/rds/v3/configurations/urls.go: -------------------------------------------------------------------------------- 1 | package configurations 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(sc *gophercloud.ServiceClient) string { 6 | return sc.ServiceURL("configurations") 7 | } 8 | 9 | func createURL(sc *gophercloud.ServiceClient) string { 10 | return sc.ServiceURL("configurations") 11 | } 12 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/migrate/results.go: -------------------------------------------------------------------------------- 1 | package migrate 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // MigrateResult is the response from a Migrate operation. Call its ExtractErr 8 | // method to determine if the request suceeded or failed. 9 | type MigrateResult struct { 10 | gophercloud.ErrResult 11 | } 12 | -------------------------------------------------------------------------------- /openstack/ecs/v1_1/cloudservers/urls.go: -------------------------------------------------------------------------------- 1 | package cloudservers 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func createURL(sc *gophercloud.ServiceClient) string { 6 | return sc.ServiceURL("cloudservers") 7 | } 8 | 9 | func jobURL(sc *gophercloud.ServiceClient, jobId string) string { 10 | return sc.ServiceURL("jobs", jobId) 11 | } 12 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/fwaas/rules/errors.go: -------------------------------------------------------------------------------- 1 | package rules 2 | 3 | import "fmt" 4 | 5 | func err(str string) error { 6 | return fmt.Errorf("%s", str) 7 | } 8 | 9 | var ( 10 | errProtocolRequired = err("A protocol is required (tcp, udp, icmp or any)") 11 | errActionRequired = err("An action is required (allow or deny)") 12 | ) 13 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/volumes/testing/doc.go: -------------------------------------------------------------------------------- 1 | // volumes_v1 2 | package testing 3 | 4 | /* 5 | This is package created is to hold fixtures (which imports testing), 6 | so that importing volumes package does not inadvertently import testing into production code 7 | More information here: 8 | https://github.com/rackspace/gophercloud/issues/473 9 | */ 10 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/resetstate/results.go: -------------------------------------------------------------------------------- 1 | package resetstate 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // ResetResult is the response of a ResetState operation. Call its ExtractErr 8 | // method to determine if the request suceeded or failed. 9 | type ResetResult struct { 10 | gophercloud.ErrResult 11 | } 12 | -------------------------------------------------------------------------------- /openstack/db/v1/flavors/doc.go: -------------------------------------------------------------------------------- 1 | // Package flavors provides information and interaction with the flavor API 2 | // resource in the OpenStack Database service. 3 | // 4 | // A flavor is an available hardware configuration for a database instance. 5 | // Each flavor has a unique combination of disk space, memory capacity and 6 | // priority for CPU time. 7 | package flavors 8 | -------------------------------------------------------------------------------- /openstack/db/v1/instances/doc.go: -------------------------------------------------------------------------------- 1 | // Package instances provides information and interaction with the instance API 2 | // resource in the OpenStack Database service. 3 | // 4 | // A database instance is an isolated database environment with compute and 5 | // storage resources in a single tenant environment on a shared physical host 6 | // machine. 7 | package instances 8 | -------------------------------------------------------------------------------- /script/coverage: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | n=1 6 | for testpkg in $(go list ./testing ./.../testing); do 7 | covpkg="${testpkg/"/testing"/}" 8 | go test -covermode count -coverprofile "testing_"$n.coverprofile -coverpkg $covpkg $testpkg 2>/dev/null 9 | n=$((n+1)) 10 | done 11 | gocovmerge `ls *.coverprofile` > cover.out 12 | rm *.coverprofile 13 | -------------------------------------------------------------------------------- /openstack/bss/v1/utilities/urls.go: -------------------------------------------------------------------------------- 1 | package utilities 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | //POST /v1.0/{partner_id}/partner/common-mgr/verificationcode 6 | func getSendVerificationCodeURL(client *gophercloud.ServiceClient, domainId string) string { 7 | return client.ServiceURL(domainId, "partner/common-mgr/verificationcode") 8 | } 9 | 10 | 11 | -------------------------------------------------------------------------------- /openstack/as/v1/quotas/urls.go: -------------------------------------------------------------------------------- 1 | package quotas 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func ListURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("quotas") 9 | } 10 | 11 | func ListWithInstancesURL(c *gophercloud.ServiceClient, scalingGroupId string) string { 12 | return c.ServiceURL("quotas", scalingGroupId) 13 | } 14 | -------------------------------------------------------------------------------- /openstack/bssintl/v1/utilities/urls.go: -------------------------------------------------------------------------------- 1 | package utilities 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | //POST /v1.0/{partner_id}/partner/common-mgr/verificationcode 6 | func getSendVerificationCodeURL(client *gophercloud.ServiceClient, domainId string) string { 7 | return client.ServiceURL(domainId, "partner/common-mgr/verificationcode") 8 | } 9 | 10 | 11 | -------------------------------------------------------------------------------- /openstack/cdn/v1/services/doc.go: -------------------------------------------------------------------------------- 1 | // Package services provides information and interaction with the services API 2 | // resource in the OpenStack CDN service. This API resource allows for 3 | // listing, creating, updating, retrieving, and deleting services. 4 | // 5 | // A service represents an application that has its content cached to the edge 6 | // nodes. 7 | package services 8 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/layer3/doc.go: -------------------------------------------------------------------------------- 1 | // Package layer3 provides access to the Layer-3 networking extension for the 2 | // OpenStack Neutron service. This extension allows API users to route packets 3 | // between subnets, forward packets from internal networks to external ones, 4 | // and access instances from external networks through floating IPs. 5 | package layer3 6 | -------------------------------------------------------------------------------- /openstack/identity/v3/endpoints/urls.go: -------------------------------------------------------------------------------- 1 | package endpoints 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(client *gophercloud.ServiceClient) string { 6 | return client.ServiceURL("endpoints") 7 | } 8 | 9 | func endpointURL(client *gophercloud.ServiceClient, endpointID string) string { 10 | return client.ServiceURL("endpoints", endpointID) 11 | } 12 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/stackresources/doc.go: -------------------------------------------------------------------------------- 1 | // Package stackresources provides operations for working with stack resources. 2 | // A resource is a template artifact that represents some component of your 3 | // desired architecture (a Cloud Server, a group of scaled Cloud Servers, a load 4 | // balancer, some configuration management system, and so forth). 5 | package stackresources 6 | -------------------------------------------------------------------------------- /acceptance/openstack/orchestration/v1/hello-compute.json: -------------------------------------------------------------------------------- 1 | { 2 | "heat_template_version": "2013-05-23", 3 | "resources": { 4 | "compute_instance": { 5 | "type": "OS::Nova::Server", 6 | "properties": { 7 | "flavor": "m1.small", 8 | "image": "cirros-0.3.2-x86_64-disk", 9 | "name": "Single Compute Instance" 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/availabilityzones/urls.go: -------------------------------------------------------------------------------- 1 | package availabilityzones 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("os-availability-zone") 7 | } 8 | 9 | func listDetailURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL("os-availability-zone", "detail") 11 | } 12 | -------------------------------------------------------------------------------- /openstack/iam/v3/projects/urls.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | 6 | func updateURL(client *gophercloud.ServiceClient, projectID string) string { 7 | return client.ServiceURL("projects", projectID) 8 | } 9 | 10 | func getURL(client *gophercloud.ServiceClient, projectID string) string { 11 | return client.ServiceURL("projects", projectID) 12 | } -------------------------------------------------------------------------------- /openstack/networking/v2/common/common_tests.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/testhelper/client" 6 | ) 7 | 8 | const TokenID = client.TokenID 9 | 10 | func ServiceClient() *gophercloud.ServiceClient { 11 | sc := client.ServiceClient() 12 | sc.ResourceBase = sc.Endpoint + "v2.0/" 13 | return sc 14 | } 15 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/security/groups/urls.go: -------------------------------------------------------------------------------- 1 | package groups 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const rootPath = "security-groups" 6 | 7 | func rootURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL(rootPath) 9 | } 10 | 11 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 12 | return c.ServiceURL(rootPath, id) 13 | } 14 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/stacktemplates/urls.go: -------------------------------------------------------------------------------- 1 | package stacktemplates 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func getURL(c *gophercloud.ServiceClient, stackName, stackID string) string { 6 | return c.ServiceURL("stacks", stackName, stackID, "template") 7 | } 8 | 9 | func validateURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL("validate") 11 | } 12 | -------------------------------------------------------------------------------- /openstack/ecs/v1/flavor/urls.go: -------------------------------------------------------------------------------- 1 | package flavor 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // GET list url 6 | func getListUrl(sc *gophercloud.ServiceClient) string { 7 | return sc.ServiceURL("cloudservers","flavors") 8 | } 9 | 10 | // Resize url 11 | func resizeURL(sc *gophercloud.ServiceClient,serverId string) string { 12 | return sc.ServiceURL("cloudservers",serverId,"resize") 13 | } -------------------------------------------------------------------------------- /openstack/networking/v2/apiversions/urls.go: -------------------------------------------------------------------------------- 1 | package apiversions 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/gophercloud/gophercloud" 7 | ) 8 | 9 | func apiVersionsURL(c *gophercloud.ServiceClient) string { 10 | return c.Endpoint 11 | } 12 | 13 | func apiInfoURL(c *gophercloud.ServiceClient, version string) string { 14 | return c.Endpoint + strings.TrimRight(version, "/") + "/" 15 | } 16 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/security/rules/urls.go: -------------------------------------------------------------------------------- 1 | package rules 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const rootPath = "security-group-rules" 6 | 7 | func rootURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL(rootPath) 9 | } 10 | 11 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 12 | return c.ServiceURL(rootPath, id) 13 | } 14 | -------------------------------------------------------------------------------- /pagination/testing/pagination_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/testhelper" 6 | ) 7 | 8 | func createClient() *gophercloud.ServiceClient { 9 | return &gophercloud.ServiceClient{ 10 | ProviderClient: &gophercloud.ProviderClient{TokenID: "abc123"}, 11 | Endpoint: testhelper.Endpoint(), 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /openstack/db/v1/users/urls.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func baseURL(c *gophercloud.ServiceClient, instanceID string) string { 6 | return c.ServiceURL("instances", instanceID, "users") 7 | } 8 | 9 | func userURL(c *gophercloud.ServiceClient, instanceID, userName string) string { 10 | return c.ServiceURL("instances", instanceID, "users", userName) 11 | } 12 | -------------------------------------------------------------------------------- /openstack/objectstorage/v1/swauth/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package swauth implements Swift's built-in authentication. 3 | 4 | Example to Authenticate with swauth 5 | 6 | authOpts := swauth.AuthOpts{ 7 | User: "project:user", 8 | Key: "password", 9 | } 10 | 11 | swiftClient, err := swauth.NewObjectStorageV1(providerClient, authOpts) 12 | if err != nil { 13 | panic(err) 14 | } 15 | */ 16 | package swauth 17 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/defsecrules/urls.go: -------------------------------------------------------------------------------- 1 | package defsecrules 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const rulepath = "os-security-group-default-rules" 6 | 7 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 8 | return c.ServiceURL(rulepath, id) 9 | } 10 | 11 | func rootURL(c *gophercloud.ServiceClient) string { 12 | return c.ServiceURL(rulepath) 13 | } 14 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/layer3/floatingips/urls.go: -------------------------------------------------------------------------------- 1 | package floatingips 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const resourcePath = "floatingips" 6 | 7 | func rootURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL(resourcePath) 9 | } 10 | 11 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 12 | return c.ServiceURL(resourcePath, id) 13 | } 14 | -------------------------------------------------------------------------------- /openstack/db/v1/databases/urls.go: -------------------------------------------------------------------------------- 1 | package databases 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func baseURL(c *gophercloud.ServiceClient, instanceID string) string { 6 | return c.ServiceURL("instances", instanceID, "databases") 7 | } 8 | 9 | func dbURL(c *gophercloud.ServiceClient, instanceID, dbName string) string { 10 | return c.ServiceURL("instances", instanceID, "databases", dbName) 11 | } 12 | -------------------------------------------------------------------------------- /openstack/bss/v1/payperuseresource/urls.go: -------------------------------------------------------------------------------- 1 | package payperuseresource 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | //POST /v1.0/{partner_id}/partner/customer-mgr/customer-resource/query-resources 6 | func getQueryCustomerResourceURL(client *gophercloud.ServiceClient, domainId string) string { 7 | return client.ServiceURL(domainId, "partner/customer-mgr/customer-resource/query-resources") 8 | } 9 | 10 | 11 | -------------------------------------------------------------------------------- /openstack/cdn/v1/serviceassets/doc.go: -------------------------------------------------------------------------------- 1 | // Package serviceassets provides information and interaction with the 2 | // serviceassets API resource in the OpenStack CDN service. This API resource 3 | // allows for deleting cached assets. 4 | // 5 | // A service distributes assets across the network. Service assets let you 6 | // interrogate properties about these assets and perform certain actions on them. 7 | package serviceassets 8 | -------------------------------------------------------------------------------- /openstack/bssintl/v1/payperuseresource/urls.go: -------------------------------------------------------------------------------- 1 | package payperuseresource 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | //POST /v1.0/{partner_id}/partner/customer-mgr/customer-resource/query-resources 6 | func getQueryCustomerResourceURL(client *gophercloud.ServiceClient, domainId string) string { 7 | return client.ServiceURL(domainId, "partner/customer-mgr/customer-resource/query-resources") 8 | } 9 | 10 | 11 | -------------------------------------------------------------------------------- /openstack/rds/v3/db_privilege/urls.go: -------------------------------------------------------------------------------- 1 | package db_privilege 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func createURL(sc *gophercloud.ServiceClient, instanceID string) string { 6 | return sc.ServiceURL("instances", instanceID, "db_privilege") 7 | } 8 | 9 | func deleteURL(sc *gophercloud.ServiceClient, instanceID string) string { 10 | return sc.ServiceURL("instances", instanceID, "db_privilege") 11 | } 12 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/limits/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package limits shows rate and limit information for a tenant/project. 3 | 4 | Example to Retrieve Limits for a Tenant 5 | 6 | getOpts := limits.GetOpts{ 7 | TenantID: "tenant-id", 8 | } 9 | 10 | limits, err := limits.Get(computeClient, getOpts).Extract() 11 | if err != nil { 12 | panic(err) 13 | } 14 | 15 | fmt.Printf("%+v\n", limits) 16 | */ 17 | package limits 18 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/usage/urls.go: -------------------------------------------------------------------------------- 1 | package usage 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const resourcePath = "os-simple-tenant-usage" 6 | 7 | func getURL(client *gophercloud.ServiceClient) string { 8 | return client.ServiceURL(resourcePath) 9 | } 10 | 11 | func getTenantURL(client *gophercloud.ServiceClient, tenantID string) string { 12 | return client.ServiceURL(resourcePath, tenantID) 13 | } 14 | -------------------------------------------------------------------------------- /openstack/objectstorage/v1/objects/errors.go: -------------------------------------------------------------------------------- 1 | package objects 2 | 3 | //import "github.com/gophercloud/gophercloud" 4 | 5 | // ErrWrongChecksum is the error when the checksum generated for an object 6 | // doesn't match the ETAG header. 7 | //type ErrWrongChecksum struct { 8 | // gophercloud.BaseError 9 | //} 10 | 11 | //func (e ErrWrongChecksum) Error() string { 12 | // return "Local checksum does not match API ETag header" 13 | //} 14 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/volumetypes/urls.go: -------------------------------------------------------------------------------- 1 | package volumetypes 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // listURL generate URL for list volumetypes. 6 | func listURL(c *gophercloud.ServiceClient) string { 7 | return c.ServiceURL("types") 8 | } 9 | 10 | // getURL generate URL for get volumetype with id. 11 | func getURL(c *gophercloud.ServiceClient, id string) string { 12 | return c.ServiceURL("types", id) 13 | } 14 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/bootfromvolume/results.go: -------------------------------------------------------------------------------- 1 | package bootfromvolume 2 | 3 | import ( 4 | os "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" 5 | ) 6 | 7 | // CreateResult temporarily contains the response from a Create call. 8 | // It embeds the standard servers.CreateResults type and so can be used the 9 | // same way as a standard server request result. 10 | type CreateResult struct { 11 | os.CreateResult 12 | } 13 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/resetstate/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package resetstate provides functionality to reset the state of a server that has 3 | been provisioned by the OpenStack Compute service. 4 | 5 | Example to Reset a Server 6 | 7 | serverID := "47b6b7b7-568d-40e4-868c-d5c41735532e" 8 | err := resetstate.ResetState(client, id, resetstate.StateActive).ExtractErr() 9 | if err != nil { 10 | panic(err) 11 | } 12 | */ 13 | package resetstate 14 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas/vips/urls.go: -------------------------------------------------------------------------------- 1 | package vips 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "lb" 7 | resourcePath = "vips" 8 | ) 9 | 10 | func rootURL(c *gophercloud.ServiceClient) string { 11 | return c.ServiceURL(rootPath, resourcePath) 12 | } 13 | 14 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 15 | return c.ServiceURL(rootPath, resourcePath, id) 16 | } 17 | -------------------------------------------------------------------------------- /openstack/ecs/v1/job/requests.go: -------------------------------------------------------------------------------- 1 | package job 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // Querying the task status based on its job ID. 6 | func GetJobResult(client *gophercloud.ServiceClient, id string) (JobResult, error) { 7 | var r JobExecResult 8 | url := jobURL(client, id) 9 | 10 | _, err := client.Get(url, &r.Body, nil) 11 | if err != nil { 12 | return JobResult{}, err 13 | } 14 | 15 | return r.ExtractJobResult() 16 | } 17 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/fwaas/rules/urls.go: -------------------------------------------------------------------------------- 1 | package rules 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "fw" 7 | resourcePath = "firewall_rules" 8 | ) 9 | 10 | func rootURL(c *gophercloud.ServiceClient) string { 11 | return c.ServiceURL(rootPath, resourcePath) 12 | } 13 | 14 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 15 | return c.ServiceURL(rootPath, resourcePath, id) 16 | } 17 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas/members/urls.go: -------------------------------------------------------------------------------- 1 | package members 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "lb" 7 | resourcePath = "members" 8 | ) 9 | 10 | func rootURL(c *gophercloud.ServiceClient) string { 11 | return c.ServiceURL(rootPath, resourcePath) 12 | } 13 | 14 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 15 | return c.ServiceURL(rootPath, resourcePath, id) 16 | } 17 | -------------------------------------------------------------------------------- /openstack/rds/v3/db_privilege/results.go: -------------------------------------------------------------------------------- 1 | package db_privilege 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | 8 | type DbprivilegeResult struct { 9 | gophercloud.Result 10 | } 11 | 12 | type Dbprivilege struct { 13 | Resp string `json:"resp"` 14 | } 15 | 16 | func (r DbprivilegeResult) Extract() (*Dbprivilege, error) { 17 | var response Dbprivilege 18 | err := r.ExtractInto(&response) 19 | return &response, err 20 | } 21 | 22 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/fwaas/firewalls/urls.go: -------------------------------------------------------------------------------- 1 | package firewalls 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "fw" 7 | resourcePath = "firewalls" 8 | ) 9 | 10 | func rootURL(c *gophercloud.ServiceClient) string { 11 | return c.ServiceURL(rootPath, resourcePath) 12 | } 13 | 14 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 15 | return c.ServiceURL(rootPath, resourcePath, id) 16 | } 17 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/apiversions/urls.go: -------------------------------------------------------------------------------- 1 | package apiversions 2 | 3 | import ( 4 | "net/url" 5 | "strings" 6 | 7 | "github.com/gophercloud/gophercloud" 8 | ) 9 | 10 | func getURL(c *gophercloud.ServiceClient, version string) string { 11 | return c.ServiceURL(strings.TrimRight(version, "/") + "/") 12 | } 13 | 14 | func listURL(c *gophercloud.ServiceClient) string { 15 | u, _ := url.Parse(c.ServiceURL("")) 16 | u.Path = "/" 17 | return u.String() 18 | } 19 | -------------------------------------------------------------------------------- /openstack/identity/v2/tokens/urls.go: -------------------------------------------------------------------------------- 1 | package tokens 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // CreateURL generates the URL used to create new Tokens. 6 | func CreateURL(client *gophercloud.ServiceClient) string { 7 | return client.ServiceURL("tokens") 8 | } 9 | 10 | // GetURL generates the URL used to Validate Tokens. 11 | func GetURL(client *gophercloud.ServiceClient, token string) string { 12 | return client.ServiceURL("tokens", token) 13 | } 14 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas/monitors/urls.go: -------------------------------------------------------------------------------- 1 | package monitors 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "lb" 7 | resourcePath = "health_monitors" 8 | ) 9 | 10 | func rootURL(c *gophercloud.ServiceClient) string { 11 | return c.ServiceURL(rootPath, resourcePath) 12 | } 13 | 14 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 15 | return c.ServiceURL(rootPath, resourcePath, id) 16 | } 17 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/listeners/urls.go: -------------------------------------------------------------------------------- 1 | package listeners 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "lbaas" 7 | resourcePath = "listeners" 8 | ) 9 | 10 | func rootURL(c *gophercloud.ServiceClient) string { 11 | return c.ServiceURL(rootPath, resourcePath) 12 | } 13 | 14 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 15 | return c.ServiceURL(rootPath, resourcePath, id) 16 | } 17 | -------------------------------------------------------------------------------- /openstack/tms/v1/predefinetags/urls.go: -------------------------------------------------------------------------------- 1 | package predefinetags 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func createOrDeleteURL(sc *gophercloud.ServiceClient) string { 6 | return sc.ServiceURL("predefine_tags/action") 7 | } 8 | 9 | func updateURL(sc *gophercloud.ServiceClient) string { 10 | return sc.ServiceURL("predefine_tags") 11 | } 12 | 13 | func listURL(sc *gophercloud.ServiceClient) string { 14 | return sc.ServiceURL("predefine_tags") 15 | } 16 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/lockunlock/results.go: -------------------------------------------------------------------------------- 1 | package lockunlock 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // LockResult and UnlockResult are the responses from a Lock and Unlock 8 | // operations respectively. Call their ExtractErr methods to determine if the 9 | // requests suceeded or failed. 10 | type LockResult struct { 11 | gophercloud.ErrResult 12 | } 13 | 14 | type UnlockResult struct { 15 | gophercloud.ErrResult 16 | } 17 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/monitors/urls.go: -------------------------------------------------------------------------------- 1 | package monitors 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "lbaas" 7 | resourcePath = "healthmonitors" 8 | ) 9 | 10 | func rootURL(c *gophercloud.ServiceClient) string { 11 | return c.ServiceURL(rootPath, resourcePath) 12 | } 13 | 14 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 15 | return c.ServiceURL(rootPath, resourcePath, id) 16 | } 17 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/certificates/urls.go: -------------------------------------------------------------------------------- 1 | package certificates 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "lbaas" 7 | resourcePath = "certificates" 8 | ) 9 | 10 | func rootURL(c *gophercloud.ServiceClient) string { 11 | return c.ServiceURL(rootPath, resourcePath) 12 | } 13 | 14 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 15 | return c.ServiceURL(rootPath, resourcePath, id) 16 | } 17 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/evacuate/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package evacuate provides functionality to evacuates servers that have been 3 | provisioned by the OpenStack Compute service from a failed host to a new host. 4 | 5 | Example to Evacuate a Server from a Host 6 | 7 | serverID := "b16ba811-199d-4ffd-8839-ba96c1185a67" 8 | err := evacuate.Evacuate(computeClient, serverID, evacuate.EvacuateOpts{}).ExtractErr() 9 | if err != nil { 10 | panic(err) 11 | } 12 | */ 13 | package evacuate 14 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/networks/urls.go: -------------------------------------------------------------------------------- 1 | package networks 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const resourcePath = "os-networks" 6 | 7 | func resourceURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL(resourcePath) 9 | } 10 | 11 | func listURL(c *gophercloud.ServiceClient) string { 12 | return resourceURL(c) 13 | } 14 | 15 | func getURL(c *gophercloud.ServiceClient, id string) string { 16 | return c.ServiceURL(resourcePath, id) 17 | } 18 | -------------------------------------------------------------------------------- /openstack/compute/v2/images/urls.go: -------------------------------------------------------------------------------- 1 | package images 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listDetailURL(client *gophercloud.ServiceClient) string { 6 | return client.ServiceURL("images", "detail") 7 | } 8 | 9 | func getURL(client *gophercloud.ServiceClient, id string) string { 10 | return client.ServiceURL("images", id) 11 | } 12 | 13 | func deleteURL(client *gophercloud.ServiceClient, id string) string { 14 | return client.ServiceURL("images", id) 15 | } 16 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/services/requests.go: -------------------------------------------------------------------------------- 1 | package services 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List makes a request against the API to list services. 9 | func List(client *gophercloud.ServiceClient) pagination.Pager { 10 | return pagination.NewPager(client, listURL(client), func(r pagination.PageResult) pagination.Page { 11 | return ServicePage{pagination.SinglePageBase(r)} 12 | }) 13 | } 14 | -------------------------------------------------------------------------------- /openstack/imageservice/v2/imagedata/urls.go: -------------------------------------------------------------------------------- 1 | package imagedata 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // `imageDataURL(c,i)` is the URL for the binary image data for the 6 | // image identified by ID `i` in the service `c`. 7 | func uploadURL(c *gophercloud.ServiceClient, imageID string) string { 8 | return c.ServiceURL("images", imageID, "file") 9 | } 10 | 11 | func downloadURL(c *gophercloud.ServiceClient, imageID string) string { 12 | return uploadURL(c, imageID) 13 | } 14 | -------------------------------------------------------------------------------- /openstack/common/extensions/urls.go: -------------------------------------------------------------------------------- 1 | package extensions 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // ExtensionURL generates the URL for an extension resource by name. 6 | func ExtensionURL(c *gophercloud.ServiceClient, name string) string { 7 | return c.ServiceURL("extensions", name) 8 | } 9 | 10 | // ListExtensionURL generates the URL for the extensions resource collection. 11 | func ListExtensionURL(c *gophercloud.ServiceClient) string { 12 | return c.ServiceURL("extensions") 13 | } 14 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/tenantnetworks/urls.go: -------------------------------------------------------------------------------- 1 | package tenantnetworks 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const resourcePath = "os-tenant-networks" 6 | 7 | func resourceURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL(resourcePath) 9 | } 10 | 11 | func listURL(c *gophercloud.ServiceClient) string { 12 | return resourceURL(c) 13 | } 14 | 15 | func getURL(c *gophercloud.ServiceClient, id string) string { 16 | return c.ServiceURL(resourcePath, id) 17 | } 18 | -------------------------------------------------------------------------------- /openstack/vpc/v1/bandwidths/urls.go: -------------------------------------------------------------------------------- 1 | package bandwidths 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func GetURL(c *gophercloud.ServiceClient, bandwidthId string) string { 8 | return c.ServiceURL("bandwidths", bandwidthId) 9 | } 10 | 11 | func ListURL(c *gophercloud.ServiceClient) string { 12 | return c.ServiceURL("bandwidths") 13 | } 14 | 15 | func UpdateURL(c *gophercloud.ServiceClient, bandwidthId string) string { 16 | return c.ServiceURL("bandwidths", bandwidthId) 17 | } 18 | -------------------------------------------------------------------------------- /openstack/dns/v2/recordsets/urls.go: -------------------------------------------------------------------------------- 1 | package recordsets 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func baseURL(c *gophercloud.ServiceClient, zoneID string) string { 6 | return c.ServiceURL("zones", zoneID, "recordsets") 7 | } 8 | 9 | func rrsetURL(c *gophercloud.ServiceClient, zoneID string, rrsetID string) string { 10 | return c.ServiceURL("zones", zoneID, "recordsets", rrsetID) 11 | } 12 | 13 | func listURL(c *gophercloud.ServiceClient) string { 14 | return c.ServiceURL("recordsets") 15 | } -------------------------------------------------------------------------------- /openstack/orchestration/v1/apiversions/requests.go: -------------------------------------------------------------------------------- 1 | package apiversions 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // ListVersions lists all the Neutron API versions available to end-users 9 | func ListVersions(c *gophercloud.ServiceClient) pagination.Pager { 10 | return pagination.NewPager(c, apiVersionsURL(c), func(r pagination.PageResult) pagination.Page { 11 | return APIVersionPage{pagination.SinglePageBase(r)} 12 | }) 13 | } 14 | -------------------------------------------------------------------------------- /openstack/sharedfilesystems/v2/availabilityzones/requests.go: -------------------------------------------------------------------------------- 1 | package availabilityzones 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List will return the existing availability zones. 9 | func List(client *gophercloud.ServiceClient) pagination.Pager { 10 | return pagination.NewPager(client, listURL(client), func(r pagination.PageResult) pagination.Page { 11 | return AvailabilityZonePage{pagination.SinglePageBase(r)} 12 | }) 13 | } 14 | -------------------------------------------------------------------------------- /openstack/blockstorage/noauth/testing/fixtures.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | // NoAuthResult is the expected result of the noauth Service Client 4 | type NoAuthResult struct { 5 | TokenID string 6 | Endpoint string 7 | } 8 | 9 | var naTestResult = NoAuthResult{ 10 | TokenID: "user:test", 11 | Endpoint: "http://cinder:8776/v2/test/", 12 | } 13 | 14 | var naResult = NoAuthResult{ 15 | TokenID: "admin:admin", 16 | Endpoint: "http://cinder:8776/v2/admin/", 17 | } 18 | 19 | var errorResult = "CinderEndpoint is required" 20 | -------------------------------------------------------------------------------- /openstack/sharedfilesystems/apiversions/urls.go: -------------------------------------------------------------------------------- 1 | package apiversions 2 | 3 | import ( 4 | "net/url" 5 | "strings" 6 | 7 | "github.com/gophercloud/gophercloud" 8 | ) 9 | 10 | func getURL(c *gophercloud.ServiceClient, version string) string { 11 | u, _ := url.Parse(c.ServiceURL("")) 12 | u.Path = "/" + strings.TrimRight(version, "/") + "/" 13 | return u.String() 14 | } 15 | 16 | func listURL(c *gophercloud.ServiceClient) string { 17 | u, _ := url.Parse(c.ServiceURL("")) 18 | u.Path = "/" 19 | return u.String() 20 | } 21 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/volumetypes/urls.go: -------------------------------------------------------------------------------- 1 | package volumetypes 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("types") 7 | } 8 | 9 | func createURL(c *gophercloud.ServiceClient) string { 10 | return listURL(c) 11 | } 12 | 13 | func getURL(c *gophercloud.ServiceClient, id string) string { 14 | return c.ServiceURL("types", id) 15 | } 16 | 17 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 18 | return getURL(c, id) 19 | } 20 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/startstop/results.go: -------------------------------------------------------------------------------- 1 | package startstop 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // StartResult is the response from a Start operation. Call its ExtractErr 6 | // method to determine if the request succeeded or failed. 7 | type StartResult struct { 8 | gophercloud.ErrResult 9 | } 10 | 11 | // StopResult is the response from Stop operation. Call its ExtractErr 12 | // method to determine if the request succeeded or failed. 13 | type StopResult struct { 14 | gophercloud.ErrResult 15 | } 16 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/whitelist/urls.go: -------------------------------------------------------------------------------- 1 | package whitelist 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | ROOTPATH = "lbaas" 7 | RESOURCEPATH = "whitelists" 8 | ) 9 | //GET list and post url 10 | func rootURL(c *gophercloud.ServiceClient) string { 11 | return c.ServiceURL(ROOTPATH, RESOURCEPATH) 12 | } 13 | //GET details put delete url 14 | func resourceURL(c *gophercloud.ServiceClient, whitelistId string) string { 15 | return c.ServiceURL(ROOTPATH, RESOURCEPATH, whitelistId) 16 | } 17 | -------------------------------------------------------------------------------- /openstack/ces/v1/events/results.go: -------------------------------------------------------------------------------- 1 | package events 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | type Event struct { 8 | // 事件ID。 9 | EventId string `json:"event_id"` 10 | // 事件名称。 必须以字母开头,只能包含0-9/a-z/A-Z/_,长度最短为1,最大为64。 11 | EventName string `json:"event_name"` 12 | } 13 | 14 | type Events []Event 15 | 16 | type CreateResult struct { 17 | gophercloud.Result 18 | } 19 | 20 | func (r CreateResult) Extract() (*Events, error) { 21 | var s *Events 22 | err := r.ExtractInto(&s) 23 | return s, err 24 | } 25 | -------------------------------------------------------------------------------- /testhelper/client/fake.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/testhelper" 6 | ) 7 | 8 | // Fake token to use. 9 | const TokenID = "cbc36478b0bd8e67e89469c7749d4127" 10 | 11 | // ServiceClient returns a generic service client for use in tests. 12 | func ServiceClient() *gophercloud.ServiceClient { 13 | return &gophercloud.ServiceClient{ 14 | ProviderClient: &gophercloud.ProviderClient{TokenID: TokenID}, 15 | Endpoint: testhelper.Endpoint(), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/services/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package services returns information about the compute services in the OpenStack 3 | cloud. 4 | 5 | Example of Retrieving list of all services 6 | 7 | allPages, err := services.List(computeClient).AllPages() 8 | if err != nil { 9 | panic(err) 10 | } 11 | 12 | allServices, err := services.ExtractServices(allPages) 13 | if err != nil { 14 | panic(err) 15 | } 16 | 17 | for _, service := range allServices { 18 | fmt.Printf("%+v\n", service) 19 | } 20 | */ 21 | 22 | package services 23 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/availabilityzones/requests.go: -------------------------------------------------------------------------------- 1 | package availabilityzones 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List will return the existing availability zones. 9 | func List(client *gophercloud.ServiceClient) pagination.Pager { 10 | return pagination.NewPager( 11 | client, 12 | listURL(client), 13 | func(r pagination.PageResult) pagination.Page { 14 | return AvailabilityZonePage{pagination.SinglePageBase(r)} 15 | }, 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/pauseunpause/results.go: -------------------------------------------------------------------------------- 1 | package pauseunpause 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // PauseResult is the response from a Pause operation. Call its ExtractErr 6 | // method to determine if the request succeeded or failed. 7 | type PauseResult struct { 8 | gophercloud.ErrResult 9 | } 10 | 11 | // UnpauseResult is the response from an Unpause operation. Call its ExtractErr 12 | // method to determine if the request succeeded or failed. 13 | type UnpauseResult struct { 14 | gophercloud.ErrResult 15 | } 16 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/startstop/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package startstop provides functionality to start and stop servers that have 3 | been provisioned by the OpenStack Compute service. 4 | 5 | Example to Stop and Start a Server 6 | 7 | serverID := "47b6b7b7-568d-40e4-868c-d5c41735532e" 8 | 9 | err := startstop.Stop(computeClient, serverID).ExtractErr() 10 | if err != nil { 11 | panic(err) 12 | } 13 | 14 | err := startstop.Start(computeClient, serverID).ExtractErr() 15 | if err != nil { 16 | panic(err) 17 | } 18 | */ 19 | package startstop 20 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/lockunlock/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package lockunlock provides functionality to lock and unlock servers that 3 | have been provisioned by the OpenStack Compute service. 4 | 5 | Example to Lock and Unlock a Server 6 | 7 | serverID := "47b6b7b7-568d-40e4-868c-d5c41735532e" 8 | 9 | err := lockunlock.Lock(computeClient, serverID).ExtractErr() 10 | if err != nil { 11 | panic(err) 12 | } 13 | 14 | err = lockunlock.Unlock(computeClient, serverID).ExtractErr() 15 | if err != nil { 16 | panic(err) 17 | } 18 | */ 19 | package lockunlock 20 | -------------------------------------------------------------------------------- /openstack/bssintl/v1/customercredit/urls.go: -------------------------------------------------------------------------------- 1 | package customercredit 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | //GET /v1.0/{partner_id}/partner/account-mgr/credit 6 | func getQueryCreditURL(client *gophercloud.ServiceClient, domainId string) string { 7 | return client.ServiceURL(domainId, "partner/account-mgr/credit") 8 | } 9 | 10 | //POST /v1.0/{partner_id}/partner/account-mgr/credit 11 | func getSetCreditURL(client *gophercloud.ServiceClient, domainId string) string { 12 | return client.ServiceURL(domainId, "partner/account-mgr/credit") 13 | } 14 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/pauseunpause/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package pauseunpause provides functionality to pause and unpause servers that 3 | have been provisioned by the OpenStack Compute service. 4 | 5 | Example to Pause and Unpause a Server 6 | 7 | serverID := "32c8baf7-1cdb-4cc2-bc31-c3a55b89f56b" 8 | err := pauseunpause.Pause(computeClient, serverID).ExtractErr() 9 | if err != nil { 10 | panic(err) 11 | } 12 | 13 | err = pauseunpause.Unpause(computeClient, serverID).ExtractErr() 14 | if err != nil { 15 | panic(err) 16 | } 17 | */ 18 | package pauseunpause 19 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/suspendresume/results.go: -------------------------------------------------------------------------------- 1 | package suspendresume 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // SuspendResult is the response from a Suspend operation. Call its 6 | // ExtractErr method to determine if the request succeeded or failed. 7 | type SuspendResult struct { 8 | gophercloud.ErrResult 9 | } 10 | 11 | // UnsuspendResult is the response from an Unsuspend operation. Call 12 | // its ExtractErr method to determine if the request succeeded or failed. 13 | type UnsuspendResult struct { 14 | gophercloud.ErrResult 15 | } 16 | -------------------------------------------------------------------------------- /openstack/blockstorage/extensions/services/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package services returns information about the blockstorage services in the 3 | OpenStack cloud. 4 | 5 | Example of Retrieving list of all services 6 | 7 | allPages, err := services.List(blockstorageClient, services.ListOpts{}).AllPages() 8 | if err != nil { 9 | panic(err) 10 | } 11 | 12 | allServices, err := services.ExtractServices(allPages) 13 | if err != nil { 14 | panic(err) 15 | } 16 | 17 | for _, service := range allServices { 18 | fmt.Printf("%+v\n", service) 19 | } 20 | */ 21 | 22 | package services 23 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/stacks/doc.go: -------------------------------------------------------------------------------- 1 | // Package stacks provides operation for working with Heat stacks. A stack is a 2 | // group of resources (servers, load balancers, databases, and so forth) 3 | // combined to fulfill a useful purpose. Based on a template, Heat orchestration 4 | // engine creates an instantiated set of resources (a stack) to run the 5 | // application framework or component specified (in the template). A stack is a 6 | // running instance of a template. The result of creating a stack is a deployment 7 | // of the application framework or component. 8 | package stacks 9 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/suspendresume/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package suspendresume provides functionality to suspend and resume servers that have 3 | been provisioned by the OpenStack Compute service. 4 | 5 | Example to Suspend and Resume a Server 6 | 7 | serverID := "47b6b7b7-568d-40e4-868c-d5c41735532e" 8 | 9 | err := suspendresume.Suspend(computeClient, serverID).ExtractErr() 10 | if err != nil { 11 | panic(err) 12 | } 13 | 14 | err := suspendresume.Resume(computeClient, serverID).ExtractErr() 15 | if err != nil { 16 | panic(err) 17 | } 18 | */ 19 | package suspendresume 20 | -------------------------------------------------------------------------------- /openstack/rds/v3/db_user/urls.go: -------------------------------------------------------------------------------- 1 | package db_user 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func createURL(sc *gophercloud.ServiceClient, instanceID string) string { 6 | return sc.ServiceURL("instances", instanceID, "db_user") 7 | } 8 | 9 | func listURL(sc *gophercloud.ServiceClient, instanceID string) string { 10 | return sc.ServiceURL("instances", instanceID, "db_user", "detail") 11 | } 12 | 13 | func deleteURL(sc *gophercloud.ServiceClient, instanceID string, dbuser string) string { 14 | return sc.ServiceURL("instances", instanceID, "db_user",dbuser) 15 | } 16 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/volumetypes/doc.go: -------------------------------------------------------------------------------- 1 | // Package volumetypes provides information and interaction with volume types 2 | // in the OpenStack Block Storage service. A volume type indicates the type of 3 | // a block storage volume, such as SATA, SCSCI, SSD, etc. These can be 4 | // customized or defined by the OpenStack admin. 5 | // 6 | // You can also define extra_specs associated with your volume types. For 7 | // instance, you could have a VolumeType=SATA, with extra_specs (RPM=10000, 8 | // RAID-Level=5) . Extra_specs are defined and customized by the admin. 9 | package volumetypes 10 | -------------------------------------------------------------------------------- /openstack/rds/v3/database/urls.go: -------------------------------------------------------------------------------- 1 | package database 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | 6 | func createURL(sc *gophercloud.ServiceClient, instanceID string) string { 7 | return sc.ServiceURL("instances", instanceID, "database") 8 | } 9 | 10 | func listURL(sc *gophercloud.ServiceClient, instanceID string) string { 11 | return sc.ServiceURL("instances", instanceID, "database","detail") 12 | } 13 | 14 | func deleteURL(sc *gophercloud.ServiceClient, instanceID string,dbName string) string { 15 | return sc.ServiceURL("instances", instanceID, "database",dbName) 16 | } 17 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/stacktemplates/doc.go: -------------------------------------------------------------------------------- 1 | // Package stacktemplates provides operations for working with Heat templates. 2 | // A Cloud Orchestration template is a portable file, written in a user-readable 3 | // language, that describes how a set of resources should be assembled and what 4 | // software should be installed in order to produce a working stack. The template 5 | // specifies what resources should be used, what attributes can be set, and other 6 | // parameters that are critical to the successful, repeatable automation of a 7 | // specific application stack. 8 | package stacktemplates 9 | -------------------------------------------------------------------------------- /openstack/vpc/v1/bandwidths/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | You can allocate bandwidth when assigning an EIP so that the ECS bound with the EIP can use the bandwidth to access the Internet. he bandwidth displays network resource usage and can be used for service metering. 3 | 4 | Sample Code, This interface is used to update information about a bandwidth. 5 | 6 | 7 | Sample Code, This interface is used to query details about a bandwidth. 8 | 9 | 10 | Sample Code, This interface is used to query bandwidths using search criteria and to display the bandwidths in a list. 11 | 12 | 13 | */ 14 | package bandwidths 15 | -------------------------------------------------------------------------------- /openstack/bss/v1/utilities/results.go: -------------------------------------------------------------------------------- 1 | package utilities 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | 6 | 7 | type SendVerificationCodeResp struct { 8 | //Error code 9 | ErrorCode string `json:"error_code"` 10 | 11 | //Error description. 12 | ErrorMsg string `json:"error_msg"` 13 | } 14 | 15 | 16 | type SendVerificationCodeResult struct { 17 | gophercloud.Result 18 | } 19 | 20 | func (r SendVerificationCodeResult) Extract() (*SendVerificationCodeResp, error) { 21 | var res *SendVerificationCodeResp 22 | err := r.ExtractInto(&res) 23 | return res, err 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /openstack/bssintl/v1/utilities/results.go: -------------------------------------------------------------------------------- 1 | package utilities 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | 6 | 7 | type SendVerificationCodeResp struct { 8 | //Error code 9 | ErrorCode string `json:"error_code"` 10 | 11 | //Error description. 12 | ErrorMsg string `json:"error_msg"` 13 | } 14 | 15 | 16 | type SendVerificationCodeResult struct { 17 | gophercloud.Result 18 | } 19 | 20 | func (r SendVerificationCodeResult) Extract() (*SendVerificationCodeResp, error) { 21 | var res *SendVerificationCodeResp 22 | err := r.ExtractInto(&res) 23 | return res, err 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /openstack/cdn/v1/serviceassets/testing/requests_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud/openstack/cdn/v1/serviceassets" 7 | th "github.com/gophercloud/gophercloud/testhelper" 8 | fake "github.com/gophercloud/gophercloud/testhelper/client" 9 | ) 10 | 11 | func TestDelete(t *testing.T) { 12 | th.SetupHTTP() 13 | defer th.TeardownHTTP() 14 | 15 | HandleDeleteCDNAssetSuccessfully(t) 16 | 17 | err := serviceassets.Delete(fake.ServiceClient(), "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0", nil).ExtractErr() 18 | th.AssertNoErr(t, err) 19 | } 20 | -------------------------------------------------------------------------------- /openstack/db/v1/instances/urls.go: -------------------------------------------------------------------------------- 1 | package instances 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func baseURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("instances") 7 | } 8 | 9 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 10 | return c.ServiceURL("instances", id) 11 | } 12 | 13 | func userRootURL(c *gophercloud.ServiceClient, id string) string { 14 | return c.ServiceURL("instances", id, "root") 15 | } 16 | 17 | func actionURL(c *gophercloud.ServiceClient, id string) string { 18 | return c.ServiceURL("instances", id, "action") 19 | } 20 | -------------------------------------------------------------------------------- /script/format: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | goimports="goimports" 4 | 5 | find_files() { 6 | find . -not \( \ 7 | \( \ 8 | -wholename './output' \ 9 | -o -wholename './_output' \ 10 | -o -wholename './_gopath' \ 11 | -o -wholename './release' \ 12 | -o -wholename './target' \ 13 | -o -wholename '*/third_party/*' \ 14 | -o -wholename '*/vendor/*' \ 15 | \) -prune \ 16 | \) -name '*.go' 17 | } 18 | 19 | diff=$(find_files | xargs ${goimports} -d -e 2>&1) 20 | if [[ -n "${diff}" ]]; then 21 | echo "${diff}" 22 | exit 1 23 | fi 24 | -------------------------------------------------------------------------------- /openstack/as/v1/instances/urls.go: -------------------------------------------------------------------------------- 1 | package instances 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func ActionURL(c *gophercloud.ServiceClient, scalingGroupId string) string { 8 | return c.ServiceURL("scaling_group_instance", scalingGroupId, "action") 9 | } 10 | 11 | func DeleteURL(c *gophercloud.ServiceClient, instanceId string) string { 12 | return c.ServiceURL("scaling_group_instance", instanceId) 13 | } 14 | 15 | func ListURL(c *gophercloud.ServiceClient, scalingGroupId string) string { 16 | return c.ServiceURL("scaling_group_instance", scalingGroupId, "list") 17 | } 18 | -------------------------------------------------------------------------------- /openstack/blockstorage/extensions/schedulerstats/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package schedulerstats returns information about block storage pool capacity 3 | and utilisation. Example: 4 | 5 | listOpts := schedulerstats.ListOpts{ 6 | Detail: true, 7 | } 8 | 9 | allPages, err := schedulerstats.List(client, listOpts).AllPages() 10 | if err != nil { 11 | panic(err) 12 | } 13 | 14 | allStats, err := schedulerstats.ExtractStoragePools(allPages) 15 | if err != nil { 16 | panic(err) 17 | } 18 | 19 | for _, stat := range allStats { 20 | fmt.Printf("%+v\n", stat) 21 | } 22 | */ 23 | package schedulerstats 24 | -------------------------------------------------------------------------------- /openstack/identity/v2/users/urls.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | tenantPath = "tenants" 7 | userPath = "users" 8 | rolePath = "roles" 9 | ) 10 | 11 | func ResourceURL(c *gophercloud.ServiceClient, id string) string { 12 | return c.ServiceURL(userPath, id) 13 | } 14 | 15 | func rootURL(c *gophercloud.ServiceClient) string { 16 | return c.ServiceURL(userPath) 17 | } 18 | 19 | func listRolesURL(c *gophercloud.ServiceClient, tenantID, userID string) string { 20 | return c.ServiceURL(tenantPath, tenantID, userPath, userID, rolePath) 21 | } 22 | -------------------------------------------------------------------------------- /acceptance/openstack/orchestration/v1/buildinfo_test.go: -------------------------------------------------------------------------------- 1 | // +build acceptance 2 | 3 | package v1 4 | 5 | import ( 6 | "testing" 7 | 8 | "github.com/gophercloud/gophercloud/openstack/orchestration/v1/buildinfo" 9 | th "github.com/gophercloud/gophercloud/testhelper" 10 | ) 11 | 12 | func TestBuildInfo(t *testing.T) { 13 | // Create a provider client for making the HTTP requests. 14 | // See common.go in this directory for more information. 15 | client := newClient(t) 16 | 17 | bi, err := buildinfo.Get(client).Extract() 18 | th.AssertNoErr(t, err) 19 | t.Logf("retrieved build info: %+v\n", bi) 20 | } 21 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/extensions/requests.go: -------------------------------------------------------------------------------- 1 | package extensions 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List returns a Pager which allows you to iterate over the full collection of extensions. 9 | // It does not accept query parameters. 10 | func List(c *gophercloud.ServiceClient) pagination.Pager { 11 | return pagination.NewPager( 12 | c, 13 | ListExtensionURL(c), 14 | func(r pagination.PageResult) pagination.Page { 15 | return ExtensionPage{pagination.SinglePageBase(r)} 16 | }, 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /openstack/cdn/v1/base/requests.go: -------------------------------------------------------------------------------- 1 | package base 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // Get retrieves the home document, allowing the user to discover the 6 | // entire API. 7 | func Get(c *gophercloud.ServiceClient) (r GetResult) { 8 | _, r.Err = c.Get(getURL(c), &r.Body, nil) 9 | return 10 | } 11 | 12 | // Ping retrieves a ping to the server. 13 | func Ping(c *gophercloud.ServiceClient) (r PingResult) { 14 | _, r.Err = c.Get(pingURL(c), nil, &gophercloud.RequestOpts{ 15 | OkCodes: []int{204}, 16 | MoreHeaders: map[string]string{"Accept": ""}, 17 | }) 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /openstack/ces/v1/metricdata/urls.go: -------------------------------------------------------------------------------- 1 | package metricdata 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // batch query metric data url 6 | func batchQueryMetricDataURL(c *gophercloud.ServiceClient) string { 7 | return c.ServiceURL("batch-query-metric-data") 8 | } 9 | 10 | func addMetricDataURL(c *gophercloud.ServiceClient) string { 11 | return c.ServiceURL("metric-data") 12 | } 13 | 14 | func getEventDataURL(c *gophercloud.ServiceClient) string { 15 | return c.ServiceURL("event-data") 16 | } 17 | 18 | func getURL(c *gophercloud.ServiceClient) string { 19 | return c.ServiceURL("metric-data") 20 | } -------------------------------------------------------------------------------- /openstack/ecs/v1/nics/urls.go: -------------------------------------------------------------------------------- 1 | package nics 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | //add nics url 6 | func addUrl(sc *gophercloud.ServiceClient, seviceId string) string { 7 | return sc.ServiceURL("cloudservers", seviceId, "nics") 8 | } 9 | 10 | //delete nics url 11 | func deleteUrl(sc *gophercloud.ServiceClient, seviceId string) string { 12 | return sc.ServiceURL("cloudservers", seviceId, "nics", "delete") 13 | } 14 | 15 | //Bind and Unbind Virtual IP url 16 | func putURL(sc *gophercloud.ServiceClient, nicId string) string { 17 | return sc.ServiceURL("cloudservers", "nics", nicId) 18 | } 19 | -------------------------------------------------------------------------------- /openstack/vpc/v1/quotas/testing/requests_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud/openstack/vpc/v1/quotas" 7 | th "github.com/gophercloud/gophercloud/testhelper" 8 | "github.com/gophercloud/gophercloud/testhelper/client" 9 | ) 10 | 11 | func TestList(t *testing.T) { 12 | th.SetupHTTP() 13 | defer th.TeardownHTTP() 14 | HandleListSuccessfully(t) 15 | 16 | actual, err := quotas.List(client.ServiceClient(), quotas.ListOpts{ 17 | Type: "vpc", 18 | }).Extract() 19 | th.AssertNoErr(t, err) 20 | th.CheckDeepEquals(t, &ListResponse, actual) 21 | } 22 | -------------------------------------------------------------------------------- /openstack/as/v1/notifications/urls.go: -------------------------------------------------------------------------------- 1 | package notifications 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func DeleteURL(c *gophercloud.ServiceClient, scalingGroupId string, topicUrn string) string { 8 | return c.ServiceURL("scaling_notification", scalingGroupId, topicUrn) 9 | } 10 | 11 | func EnableURL(c *gophercloud.ServiceClient, scalingGroupId string) string { 12 | return c.ServiceURL("scaling_notification", scalingGroupId) 13 | } 14 | 15 | func ListURL(c *gophercloud.ServiceClient, scalingGroupId string) string { 16 | return c.ServiceURL("scaling_notification", scalingGroupId) 17 | } 18 | -------------------------------------------------------------------------------- /openstack/vpc/v1/quotas/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | This interface is used to query network resource quotas for the VPC service of a tenant. The network resources include VPCs, subnets, security groups, security group rules, elastic IP addresses, and VPNs. 3 | 4 | Sample Code, This interface is used to query network resource quotas for the VPC service of a tenant. The network resources include VPCs, subnets, security groups, security group rules, elastic IP addresses, and VPNs. 5 | 6 | 7 | result, err := quotas.List(client.ServiceClient(), tenantID, quotas.ListOpts{ 8 | Type: "vpc", 9 | }).Extract() 10 | */ 11 | package quotas 12 | -------------------------------------------------------------------------------- /openstack/as/v1/quotas/requests.go: -------------------------------------------------------------------------------- 1 | package quotas 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func List(client *gophercloud.ServiceClient) (r ListResult) { 8 | url := ListURL(client) 9 | _, r.Err = client.Get(url, &r.Body, &gophercloud.RequestOpts{ 10 | OkCodes: []int{200}, 11 | }) 12 | return 13 | } 14 | 15 | func ListWithInstances(client *gophercloud.ServiceClient, scalingGroupId string) (r ListWithInstancesResult) { 16 | url := ListWithInstancesURL(client, scalingGroupId) 17 | _, r.Err = client.Get(url, &r.Body, &gophercloud.RequestOpts{ 18 | OkCodes: []int{200}, 19 | }) 20 | return 21 | } 22 | -------------------------------------------------------------------------------- /openstack/cdn/v1/services/urls.go: -------------------------------------------------------------------------------- 1 | package services 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("services") 7 | } 8 | 9 | func createURL(c *gophercloud.ServiceClient) string { 10 | return listURL(c) 11 | } 12 | 13 | func getURL(c *gophercloud.ServiceClient, id string) string { 14 | return c.ServiceURL("services", id) 15 | } 16 | 17 | func updateURL(c *gophercloud.ServiceClient, id string) string { 18 | return getURL(c, id) 19 | } 20 | 21 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 22 | return getURL(c, id) 23 | } 24 | -------------------------------------------------------------------------------- /openstack/db/v1/datastores/urls.go: -------------------------------------------------------------------------------- 1 | package datastores 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func baseURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("datastores") 7 | } 8 | 9 | func resourceURL(c *gophercloud.ServiceClient, dsID string) string { 10 | return c.ServiceURL("datastores", dsID) 11 | } 12 | 13 | func versionsURL(c *gophercloud.ServiceClient, dsID string) string { 14 | return c.ServiceURL("datastores", dsID, "versions") 15 | } 16 | 17 | func versionURL(c *gophercloud.ServiceClient, dsID, versionID string) string { 18 | return c.ServiceURL("datastores", dsID, "versions", versionID) 19 | } 20 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/buildinfo/testing/requests_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud/openstack/orchestration/v1/buildinfo" 7 | th "github.com/gophercloud/gophercloud/testhelper" 8 | fake "github.com/gophercloud/gophercloud/testhelper/client" 9 | ) 10 | 11 | func TestGetTemplate(t *testing.T) { 12 | th.SetupHTTP() 13 | defer th.TeardownHTTP() 14 | HandleGetSuccessfully(t, GetOutput) 15 | 16 | actual, err := buildinfo.Get(fake.ServiceClient()).Extract() 17 | th.AssertNoErr(t, err) 18 | 19 | expected := GetExpected 20 | th.AssertDeepEquals(t, expected, actual) 21 | } 22 | -------------------------------------------------------------------------------- /openstack/rds/v3/datastores/requests.go: -------------------------------------------------------------------------------- 1 | package datastores 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | 9 | func List(client *gophercloud.ServiceClient, databasesname string) pagination.Pager { 10 | url := listURL(client, databasesname) 11 | 12 | pageRdsList := pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page { 13 | return DataStoresPage{pagination.Offset{PageResult: r}} 14 | }) 15 | 16 | rdsheader := map[string]string{"Content-Type": "application/json"} 17 | pageRdsList.Headers = rdsheader 18 | return pageRdsList 19 | } 20 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/snapshots/util.go: -------------------------------------------------------------------------------- 1 | package snapshots 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // WaitForStatus will continually poll the resource, checking for a particular 8 | // status. It will do this for the amount of seconds defined. 9 | func WaitForStatus(c *gophercloud.ServiceClient, id, status string, secs int) error { 10 | return gophercloud.WaitFor(secs, func() (bool, error) { 11 | current, err := Get(c, id).Extract() 12 | if err != nil { 13 | return false, err 14 | } 15 | 16 | if current.Status == status { 17 | return true, nil 18 | } 19 | 20 | return false, nil 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/volumes/urls.go: -------------------------------------------------------------------------------- 1 | package volumes 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func createURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("volumes") 7 | } 8 | 9 | func listURL(c *gophercloud.ServiceClient) string { 10 | return createURL(c) 11 | } 12 | 13 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 14 | return c.ServiceURL("volumes", id) 15 | } 16 | 17 | func getURL(c *gophercloud.ServiceClient, id string) string { 18 | return deleteURL(c, id) 19 | } 20 | 21 | func updateURL(c *gophercloud.ServiceClient, id string) string { 22 | return deleteURL(c, id) 23 | } 24 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/volumes/util.go: -------------------------------------------------------------------------------- 1 | package volumes 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // WaitForStatus will continually poll the resource, checking for a particular 8 | // status. It will do this for the amount of seconds defined. 9 | func WaitForStatus(c *gophercloud.ServiceClient, id, status string, secs int) error { 10 | return gophercloud.WaitFor(secs, func() (bool, error) { 11 | current, err := Get(c, id).Extract() 12 | if err != nil { 13 | return false, err 14 | } 15 | 16 | if current.Status == status { 17 | return true, nil 18 | } 19 | 20 | return false, nil 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/apiversions/urls.go: -------------------------------------------------------------------------------- 1 | package apiversions 2 | 3 | import ( 4 | "net/url" 5 | "strings" 6 | 7 | "github.com/gophercloud/gophercloud" 8 | ) 9 | 10 | // getURL generates URL fot getting detail of specified version 11 | func getURL(c *gophercloud.ServiceClient, version string) string { 12 | u, _ := url.Parse(c.ServiceURL("")) 13 | u.Path = "/" + strings.TrimRight(version, "/") + "/" 14 | return u.String() 15 | } 16 | 17 | // listURL generates URL for list versions 18 | func listURL(c *gophercloud.ServiceClient) string { 19 | u, _ := url.Parse(c.ServiceURL("")) 20 | u.Path = "/" 21 | return u.String() 22 | } 23 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/snapshots/util.go: -------------------------------------------------------------------------------- 1 | package snapshots 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // WaitForStatus will continually poll the resource, checking for a particular 8 | // status. It will do this for the amount of seconds defined. 9 | func WaitForStatus(c *gophercloud.ServiceClient, id, status string, secs int) error { 10 | return gophercloud.WaitFor(secs, func() (bool, error) { 11 | current, err := Get(c, id).Extract() 12 | if err != nil { 13 | return false, err 14 | } 15 | 16 | if current.Status == status { 17 | return true, nil 18 | } 19 | 20 | return false, nil 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/volumes/util.go: -------------------------------------------------------------------------------- 1 | package volumes 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // WaitForStatus will continually poll the resource, checking for a particular 8 | // status. It will do this for the amount of seconds defined. 9 | func WaitForStatus(c *gophercloud.ServiceClient, id, status string, secs int) error { 10 | return gophercloud.WaitFor(secs, func() (bool, error) { 11 | current, err := Get(c, id).Extract() 12 | if err != nil { 13 | return false, err 14 | } 15 | 16 | if current.Status == status { 17 | return true, nil 18 | } 19 | 20 | return false, nil 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /openstack/blockstorage/v3/snapshots/util.go: -------------------------------------------------------------------------------- 1 | package snapshots 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // WaitForStatus will continually poll the resource, checking for a particular 8 | // status. It will do this for the amount of seconds defined. 9 | func WaitForStatus(c *gophercloud.ServiceClient, id, status string, secs int) error { 10 | return gophercloud.WaitFor(secs, func() (bool, error) { 11 | current, err := Get(c, id).Extract() 12 | if err != nil { 13 | return false, err 14 | } 15 | 16 | if current.Status == status { 17 | return true, nil 18 | } 19 | 20 | return false, nil 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /openstack/blockstorage/v3/volumes/util.go: -------------------------------------------------------------------------------- 1 | package volumes 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // WaitForStatus will continually poll the resource, checking for a particular 8 | // status. It will do this for the amount of seconds defined. 9 | func WaitForStatus(c *gophercloud.ServiceClient, id, status string, secs int) error { 10 | return gophercloud.WaitFor(secs, func() (bool, error) { 11 | current, err := Get(c, id).Extract() 12 | if err != nil { 13 | return false, err 14 | } 15 | 16 | if current.Status == status { 17 | return true, nil 18 | } 19 | 20 | return false, nil 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /openstack/ces/v1/metrics/testing/fixtures.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | const ListResponse = ` 4 | { 5 | "metrics": [{ 6 | "namespace": "SYS.ECS", 7 | "dimensions": [{ 8 | "name": "instance_id", 9 | "value": "d9112af5-6913-4f3b-bd0a-3f96711e004d" 10 | }], 11 | "metric_name": "cpu_util", 12 | "unit": "%" 13 | }], 14 | "meta_data": { 15 | "count": 1, 16 | "marker": "SYS.ECS.cpu_util.instance_id:d9112af5-6913-4f3b-bd0a-3f96711e004d", 17 | "total": 2 18 | } 19 | } 20 | ` 21 | const EndPageResponse = ` 22 | { 23 | "metrics": [], 24 | "meta_data": { 25 | "count": 0, 26 | "marker": "", 27 | "total": 2 28 | } 29 | } 30 | ` -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/networks/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package networks provides the ability to create and manage networks in cloud 3 | environments using nova-network. 4 | 5 | This package can also be used to retrieve network details of Neutron-based 6 | networks. 7 | 8 | Example to List Networks 9 | 10 | allPages, err := networks.List(computeClient).AllPages() 11 | if err != nil { 12 | panic(err) 13 | } 14 | 15 | allNetworks, err := networks.ExtractNetworks(allPages) 16 | if err != nil { 17 | panic(err) 18 | } 19 | 20 | for _, network := range allNetworks { 21 | fmt.Printf("%+v\n", network) 22 | } 23 | */ 24 | package networks 25 | -------------------------------------------------------------------------------- /openstack/networking/v2/apiversions/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package apiversions provides information and interaction with the different 3 | API versions for the OpenStack Neutron service. This functionality is not 4 | restricted to this particular version. 5 | 6 | Example to List API Versions 7 | 8 | allPages, err := apiversions.ListVersions(networkingClient).AllPages() 9 | if err != nil { 10 | panic(err) 11 | } 12 | 13 | allVersions, err := apiversions.ExtractAPIVersions(allPages) 14 | if err != nil { 15 | panic(err) 16 | } 17 | 18 | for _, version := range allVersions { 19 | fmt.Printf("%+v\n", version) 20 | } 21 | */ 22 | package apiversions 23 | -------------------------------------------------------------------------------- /openstack/vpc/v1/privateips/urls.go: -------------------------------------------------------------------------------- 1 | package privateips 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func CreateURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("privateips") 9 | } 10 | 11 | func DeleteURL(c *gophercloud.ServiceClient, privateipId string) string { 12 | return c.ServiceURL("privateips", privateipId) 13 | } 14 | 15 | func GetURL(c *gophercloud.ServiceClient, privateipId string) string { 16 | return c.ServiceURL("privateips", privateipId) 17 | } 18 | 19 | func ListURL(c *gophercloud.ServiceClient, subnetId string) string { 20 | return c.ServiceURL("subnets", subnetId, "privateips") 21 | } 22 | -------------------------------------------------------------------------------- /openstack/blockstorage/noauth/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package noauth creates a "noauth" *gophercloud.ServiceClient for use in Cinder 3 | environments configured with the noauth authentication middleware. 4 | 5 | Example of Creating a noauth Service Client 6 | 7 | provider, err := noauth.NewClient(gophercloud.AuthOptions{ 8 | Username: os.Getenv("OS_USERNAME"), 9 | TenantName: os.Getenv("OS_TENANT_NAME"), 10 | }) 11 | client, err := noauth.NewBlockStorageNoAuth(provider, noauth.EndpointOpts{ 12 | CinderEndpoint: os.Getenv("CINDER_ENDPOINT"), 13 | }) 14 | 15 | An example of a CinderEndpoint would be: http://example.com:8776/v2, 16 | */ 17 | package noauth 18 | -------------------------------------------------------------------------------- /openstack/cdn/v1/flavors/requests.go: -------------------------------------------------------------------------------- 1 | package flavors 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List returns a single page of CDN flavors. 9 | func List(c *gophercloud.ServiceClient) pagination.Pager { 10 | return pagination.NewPager(c, listURL(c), func(r pagination.PageResult) pagination.Page { 11 | return FlavorPage{pagination.SinglePageBase(r)} 12 | }) 13 | } 14 | 15 | // Get retrieves a specific flavor based on its unique ID. 16 | func Get(c *gophercloud.ServiceClient, id string) (r GetResult) { 17 | _, r.Err = c.Get(getURL(c, id), &r.Body, nil) 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /openstack/identity/v2/extensions/admin/roles/urls.go: -------------------------------------------------------------------------------- 1 | package roles 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | ExtPath = "OS-KSADM" 7 | RolePath = "roles" 8 | UserPath = "users" 9 | ) 10 | 11 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 12 | return c.ServiceURL(ExtPath, RolePath, id) 13 | } 14 | 15 | func rootURL(c *gophercloud.ServiceClient) string { 16 | return c.ServiceURL(ExtPath, RolePath) 17 | } 18 | 19 | func userRoleURL(c *gophercloud.ServiceClient, tenantID, userID, roleID string) string { 20 | return c.ServiceURL("tenants", tenantID, UserPath, userID, RolePath, ExtPath, roleID) 21 | } 22 | -------------------------------------------------------------------------------- /openstack/vpc/v1/securitygroups/urls.go: -------------------------------------------------------------------------------- 1 | package securitygroups 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func CreateURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("security-groups") 9 | } 10 | 11 | func DeleteURL(c *gophercloud.ServiceClient, securityGroupId string) string { 12 | return c.ServiceURL("security-groups", securityGroupId) 13 | } 14 | 15 | func GetURL(c *gophercloud.ServiceClient, securityGroupId string) string { 16 | return c.ServiceURL("security-groups", securityGroupId) 17 | } 18 | 19 | func ListURL(c *gophercloud.ServiceClient) string { 20 | return c.ServiceURL("security-groups") 21 | } 22 | -------------------------------------------------------------------------------- /openstack/compute/v2/servers/util.go: -------------------------------------------------------------------------------- 1 | package servers 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // WaitForStatus will continually poll a server until it successfully 6 | // transitions to a specified status. It will do this for at most the number 7 | // of seconds specified. 8 | func WaitForStatus(c *gophercloud.ServiceClient, id, status string, secs int) error { 9 | return gophercloud.WaitFor(secs, func() (bool, error) { 10 | current, err := Get(c, id).Extract() 11 | if err != nil { 12 | return false, err 13 | } 14 | 15 | if current.Status == status { 16 | return true, nil 17 | } 18 | 19 | return false, nil 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /openstack/blockstorage/v3/volumes/urls.go: -------------------------------------------------------------------------------- 1 | package volumes 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func createURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("volumes") 7 | } 8 | 9 | func listURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL("volumes", "detail") 11 | } 12 | 13 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 14 | return c.ServiceURL("volumes", id) 15 | } 16 | 17 | func getURL(c *gophercloud.ServiceClient, id string) string { 18 | return deleteURL(c, id) 19 | } 20 | 21 | func updateURL(c *gophercloud.ServiceClient, id string) string { 22 | return deleteURL(c, id) 23 | } 24 | -------------------------------------------------------------------------------- /openstack/identity/v3/extensions/trusts/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package trusts enables management of OpenStack Identity Trusts. 3 | 4 | Example to Create a Token with Username, Password, and Trust ID 5 | 6 | var trustToken struct { 7 | tokens.Token 8 | trusts.TokenExt 9 | } 10 | 11 | authOptions := tokens.AuthOptions{ 12 | UserID: "username", 13 | Password: "password", 14 | } 15 | 16 | createOpts := trusts.AuthOptsExt{ 17 | AuthOptionsBuilder: authOptions, 18 | TrustID: "de0945a", 19 | } 20 | 21 | err := tokens.Create(identityClient, createOpts).ExtractInto(&trustToken) 22 | if err != nil { 23 | panic(err) 24 | } 25 | */ 26 | package trusts 27 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/limits/testing/requests_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/limits" 7 | th "github.com/gophercloud/gophercloud/testhelper" 8 | "github.com/gophercloud/gophercloud/testhelper/client" 9 | ) 10 | 11 | func TestGet(t *testing.T) { 12 | th.SetupHTTP() 13 | defer th.TeardownHTTP() 14 | HandleGetSuccessfully(t) 15 | 16 | getOpts := limits.GetOpts{ 17 | TenantID: TenantID, 18 | } 19 | 20 | actual, err := limits.Get(client.ServiceClient(), getOpts).Extract() 21 | th.AssertNoErr(t, err) 22 | th.CheckDeepEquals(t, &LimitsResult, actual) 23 | } 24 | -------------------------------------------------------------------------------- /openstack/blockstorage/v3/volumetypes/urls.go: -------------------------------------------------------------------------------- 1 | package volumetypes 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("types") 7 | } 8 | 9 | func getURL(c *gophercloud.ServiceClient, id string) string { 10 | return c.ServiceURL("types", id) 11 | } 12 | 13 | func createURL(c *gophercloud.ServiceClient) string { 14 | return c.ServiceURL("types") 15 | } 16 | 17 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 18 | return c.ServiceURL("types", id) 19 | } 20 | 21 | func updateURL(c *gophercloud.ServiceClient, id string) string { 22 | return c.ServiceURL("types", id) 23 | } 24 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/resetstate/testing/fixtures.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "testing" 7 | 8 | th "github.com/gophercloud/gophercloud/testhelper" 9 | "github.com/gophercloud/gophercloud/testhelper/client" 10 | ) 11 | 12 | func mockResetStateResponse(t *testing.T, id string, state string) { 13 | th.Mux.HandleFunc("/servers/"+id+"/action", func(w http.ResponseWriter, r *http.Request) { 14 | th.TestMethod(t, r, "POST") 15 | th.TestHeader(t, r, "X-Auth-Token", client.TokenID) 16 | th.TestJSONRequest(t, r, fmt.Sprintf(`{"os-resetState": {"state": "%s"}}`, state)) 17 | w.WriteHeader(http.StatusAccepted) 18 | }) 19 | } 20 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/resetstate/testing/requests_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/resetstate" 7 | th "github.com/gophercloud/gophercloud/testhelper" 8 | "github.com/gophercloud/gophercloud/testhelper/client" 9 | ) 10 | 11 | const serverID = "b16ba811-199d-4ffd-8839-ba96c1185a67" 12 | 13 | func TestResetState(t *testing.T) { 14 | th.SetupHTTP() 15 | defer th.TeardownHTTP() 16 | 17 | mockResetStateResponse(t, serverID, "active") 18 | 19 | err := resetstate.ResetState(client.ServiceClient(), serverID, "active").ExtractErr() 20 | th.AssertNoErr(t, err) 21 | } 22 | -------------------------------------------------------------------------------- /openstack/sharedfilesystems/apiversions/errors.go: -------------------------------------------------------------------------------- 1 | package apiversions 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // ErrVersionNotFound is the error when the requested API version 8 | // could not be found. 9 | type ErrVersionNotFound struct{} 10 | 11 | func (e ErrVersionNotFound) Error() string { 12 | return fmt.Sprintf("Unable to find requested API version") 13 | } 14 | 15 | // ErrMultipleVersionsFound is the error when a request for an API 16 | // version returns multiple results. 17 | type ErrMultipleVersionsFound struct { 18 | Count int 19 | } 20 | 21 | func (e ErrMultipleVersionsFound) Error() string { 22 | return fmt.Sprintf("Found %d API versions", e.Count) 23 | } 24 | -------------------------------------------------------------------------------- /openstack/vpc/v1/vpcs/urls.go: -------------------------------------------------------------------------------- 1 | package vpcs 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func CreateURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("vpcs") 9 | } 10 | 11 | func DeleteURL(c *gophercloud.ServiceClient, vpcId string) string { 12 | return c.ServiceURL("vpcs", vpcId) 13 | } 14 | 15 | func GetURL(c *gophercloud.ServiceClient, vpcId string) string { 16 | return c.ServiceURL("vpcs", vpcId) 17 | } 18 | 19 | func ListURL(c *gophercloud.ServiceClient) string { 20 | return c.ServiceURL("vpcs") 21 | } 22 | 23 | func UpdateURL(c *gophercloud.ServiceClient, vpcId string) string { 24 | return c.ServiceURL("vpcs", vpcId) 25 | } 26 | -------------------------------------------------------------------------------- /openstack/vpc/v1/ports/urls.go: -------------------------------------------------------------------------------- 1 | package ports 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func CreateURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("ports") 9 | } 10 | 11 | func DeleteURL(c *gophercloud.ServiceClient, portId string) string { 12 | return c.ServiceURL("ports", portId) 13 | } 14 | 15 | func GetURL(c *gophercloud.ServiceClient, portId string) string { 16 | return c.ServiceURL("ports", portId) 17 | } 18 | 19 | func ListURL(c *gophercloud.ServiceClient) string { 20 | return c.ServiceURL("ports") 21 | } 22 | 23 | func UpdateURL(c *gophercloud.ServiceClient, portId string) string { 24 | return c.ServiceURL("ports", portId) 25 | } -------------------------------------------------------------------------------- /openstack/as/v2/policies/urls.go: -------------------------------------------------------------------------------- 1 | package policies 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func CreateURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("scaling_policy") 9 | } 10 | 11 | func GetURL(c *gophercloud.ServiceClient, scalingPolicyId string) string { 12 | return c.ServiceURL("scaling_policy", scalingPolicyId) 13 | } 14 | 15 | func ListURL(c *gophercloud.ServiceClient, scalingResourceId string) string { 16 | return c.ServiceURL("scaling_policy", scalingResourceId, "list") 17 | } 18 | 19 | func UpdateURL(c *gophercloud.ServiceClient, scalingPolicyId string) string { 20 | return c.ServiceURL("scaling_policy", scalingPolicyId) 21 | } 22 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/keypairs/urls.go: -------------------------------------------------------------------------------- 1 | package keypairs 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const resourcePath = "os-keypairs" 6 | 7 | func resourceURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL(resourcePath) 9 | } 10 | 11 | func listURL(c *gophercloud.ServiceClient) string { 12 | return resourceURL(c) 13 | } 14 | 15 | func createURL(c *gophercloud.ServiceClient) string { 16 | return resourceURL(c) 17 | } 18 | 19 | func getURL(c *gophercloud.ServiceClient, name string) string { 20 | return c.ServiceURL(resourcePath, name) 21 | } 22 | 23 | func deleteURL(c *gophercloud.ServiceClient, name string) string { 24 | return getURL(c, name) 25 | } 26 | -------------------------------------------------------------------------------- /openstack/ecs/v2/cloudservers/urls.go: -------------------------------------------------------------------------------- 1 | package cloudservers 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func resetPwdURL(sc *gophercloud.ServiceClient, serverID string) string { 6 | return sc.ServiceURL("servers", serverID, "os-reset-password") 7 | } 8 | 9 | func changeURL(sc *gophercloud.ServiceClient, serverID string) string { 10 | return sc.ServiceURL("cloudservers", serverID, "changeos") 11 | } 12 | 13 | 14 | func reinstallOSURL(sc *gophercloud.ServiceClient, serverID string) string { 15 | return sc.ServiceURL("cloudservers", serverID, "reinstallos") 16 | } 17 | 18 | func resizeFlavorURL(sc *gophercloud.ServiceClient) string { 19 | return sc.ServiceURL("resize_flavors") 20 | } 21 | -------------------------------------------------------------------------------- /openstack/objectstorage/v1/containers/urls.go: -------------------------------------------------------------------------------- 1 | package containers 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(c *gophercloud.ServiceClient) string { 6 | return c.Endpoint 7 | } 8 | 9 | func createURL(c *gophercloud.ServiceClient, container string) string { 10 | return c.ServiceURL(container) 11 | } 12 | 13 | func getURL(c *gophercloud.ServiceClient, container string) string { 14 | return createURL(c, container) 15 | } 16 | 17 | func deleteURL(c *gophercloud.ServiceClient, container string) string { 18 | return createURL(c, container) 19 | } 20 | 21 | func updateURL(c *gophercloud.ServiceClient, container string) string { 22 | return createURL(c, container) 23 | } 24 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/servergroups/urls.go: -------------------------------------------------------------------------------- 1 | package servergroups 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const resourcePath = "os-server-groups" 6 | 7 | func resourceURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL(resourcePath) 9 | } 10 | 11 | func listURL(c *gophercloud.ServiceClient) string { 12 | return resourceURL(c) 13 | } 14 | 15 | func createURL(c *gophercloud.ServiceClient) string { 16 | return resourceURL(c) 17 | } 18 | 19 | func getURL(c *gophercloud.ServiceClient, id string) string { 20 | return c.ServiceURL(resourcePath, id) 21 | } 22 | 23 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 24 | return getURL(c, id) 25 | } 26 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/layer3/routers/urls.go: -------------------------------------------------------------------------------- 1 | package routers 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const resourcePath = "routers" 6 | 7 | func rootURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL(resourcePath) 9 | } 10 | 11 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 12 | return c.ServiceURL(resourcePath, id) 13 | } 14 | 15 | func addInterfaceURL(c *gophercloud.ServiceClient, id string) string { 16 | return c.ServiceURL(resourcePath, id, "add_router_interface") 17 | } 18 | 19 | func removeInterfaceURL(c *gophercloud.ServiceClient, id string) string { 20 | return c.ServiceURL(resourcePath, id, "remove_router_interface") 21 | } 22 | -------------------------------------------------------------------------------- /openstack/sharedfilesystems/apiversions/requests.go: -------------------------------------------------------------------------------- 1 | package apiversions 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List lists all the API versions available to end-users. 9 | func List(c *gophercloud.ServiceClient) pagination.Pager { 10 | return pagination.NewPager(c, listURL(c), func(r pagination.PageResult) pagination.Page { 11 | return APIVersionPage{pagination.SinglePageBase(r)} 12 | }) 13 | } 14 | 15 | // Get will get a specific API version, specified by major ID. 16 | func Get(client *gophercloud.ServiceClient, v string) (r GetResult) { 17 | _, r.Err = client.Get(getURL(client, v), &r.Body, nil) 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /openstack/vpc/v1/securitygrouprules/urls.go: -------------------------------------------------------------------------------- 1 | package securitygrouprules 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func CreateURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("security-group-rules") 9 | } 10 | 11 | func DeleteURL(c *gophercloud.ServiceClient, securityGroupsRulesId string) string { 12 | return c.ServiceURL("security-group-rules", securityGroupsRulesId) 13 | } 14 | 15 | func GetURL(c *gophercloud.ServiceClient, securityGroupsRulesId string) string { 16 | return c.ServiceURL("security-group-rules", securityGroupsRulesId) 17 | } 18 | 19 | func ListURL(c *gophercloud.ServiceClient) string { 20 | return c.ServiceURL("security-group-rules") 21 | } 22 | -------------------------------------------------------------------------------- /openstack/cdn/v1/base/results.go: -------------------------------------------------------------------------------- 1 | package base 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // HomeDocument is a resource that contains all the resources for the CDN API. 6 | type HomeDocument map[string]interface{} 7 | 8 | // GetResult represents the result of a Get operation. 9 | type GetResult struct { 10 | gophercloud.Result 11 | } 12 | 13 | // Extract is a function that accepts a result and extracts a home document resource. 14 | func (r GetResult) Extract() (*HomeDocument, error) { 15 | var s HomeDocument 16 | err := r.ExtractInto(&s) 17 | return &s, err 18 | } 19 | 20 | // PingResult represents the result of a Ping operation. 21 | type PingResult struct { 22 | gophercloud.ErrResult 23 | } 24 | -------------------------------------------------------------------------------- /openstack/ces/v1/alarms/urls.go: -------------------------------------------------------------------------------- 1 | package alarms 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func createURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("alarms") 9 | } 10 | 11 | func deleteURL(c *gophercloud.ServiceClient, alarmId string) string { 12 | return c.ServiceURL("alarms", alarmId) 13 | } 14 | 15 | func getURL(c *gophercloud.ServiceClient, alarmId string) string { 16 | return c.ServiceURL("alarms", alarmId) 17 | } 18 | 19 | func listURL(c *gophercloud.ServiceClient) string { 20 | return c.ServiceURL("alarms") 21 | } 22 | 23 | func updateURL(c *gophercloud.ServiceClient, alarmId string) string { 24 | return c.ServiceURL("alarms", alarmId, "action") 25 | } 26 | -------------------------------------------------------------------------------- /acceptance/openstack/common.go: -------------------------------------------------------------------------------- 1 | // Package openstack contains common functions that can be used 2 | // across all OpenStack components for acceptance testing. 3 | package openstack 4 | 5 | import ( 6 | "testing" 7 | 8 | "github.com/gophercloud/gophercloud/openstack/common/extensions" 9 | ) 10 | 11 | // PrintExtension prints an extension and all of its attributes. 12 | func PrintExtension(t *testing.T, extension *extensions.Extension) { 13 | t.Logf("Name: %s", extension.Name) 14 | t.Logf("Namespace: %s", extension.Namespace) 15 | t.Logf("Alias: %s", extension.Alias) 16 | t.Logf("Description: %s", extension.Description) 17 | t.Logf("Updated: %s", extension.Updated) 18 | t.Logf("Links: %v", extension.Links) 19 | } 20 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/apiversions/requests.go: -------------------------------------------------------------------------------- 1 | package apiversions 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List lists all the API versions available to end-users. 9 | func List(c *gophercloud.ServiceClient) pagination.Pager { 10 | return pagination.NewPager(c, listURL(c), func(r pagination.PageResult) pagination.Page { 11 | return APIVersionPage{pagination.SinglePageBase(r)} 12 | }) 13 | } 14 | 15 | // Get will get a specific API version, specified by major ID. 16 | func Get(client *gophercloud.ServiceClient, v string) (r GetResult) { 17 | _, r.Err = client.Get(getURL(client, v), &r.Body, nil) 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /openstack/sharedfilesystems/v2/securityservices/urls.go: -------------------------------------------------------------------------------- 1 | package securityservices 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func createURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("security-services") 7 | } 8 | 9 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 10 | return c.ServiceURL("security-services", id) 11 | } 12 | 13 | func listURL(c *gophercloud.ServiceClient) string { 14 | return c.ServiceURL("security-services", "detail") 15 | } 16 | 17 | func getURL(c *gophercloud.ServiceClient, id string) string { 18 | return deleteURL(c, id) 19 | } 20 | 21 | func updateURL(c *gophercloud.ServiceClient, id string) string { 22 | return deleteURL(c, id) 23 | } 24 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/hypervisors/urls.go: -------------------------------------------------------------------------------- 1 | package hypervisors 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func hypervisorsListDetailURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("os-hypervisors", "detail") 7 | } 8 | 9 | func hypervisorsStatisticsURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL("os-hypervisors", "statistics") 11 | } 12 | 13 | func hypervisorsGetURL(c *gophercloud.ServiceClient, hypervisorID string) string { 14 | return c.ServiceURL("os-hypervisors", hypervisorID) 15 | } 16 | 17 | func hypervisorsUptimeURL(c *gophercloud.ServiceClient, hypervisorID string) string { 18 | return c.ServiceURL("os-hypervisors", hypervisorID, "uptime") 19 | } 20 | -------------------------------------------------------------------------------- /openstack/db/v1/configurations/doc.go: -------------------------------------------------------------------------------- 1 | // Package configurations provides information and interaction with the 2 | // configuration API resource in the Rackspace Database service. 3 | // 4 | // A configuration group is a collection of key/value pairs which define how a 5 | // particular database operates. These key/value pairs are specific to each 6 | // datastore type and serve like settings. Some directives are capable of being 7 | // applied dynamically, while other directives require a server restart to take 8 | // effect. The configuration group can be applied to an instance at creation or 9 | // applied to an existing instance to modify the behavior of the running 10 | // datastore on the instance. 11 | package configurations 12 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/networks/requests.go: -------------------------------------------------------------------------------- 1 | package networks 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List returns a Pager that allows you to iterate over a collection of Network. 9 | func List(client *gophercloud.ServiceClient) pagination.Pager { 10 | return pagination.NewPager(client, listURL(client), func(r pagination.PageResult) pagination.Page { 11 | return NetworkPage{pagination.SinglePageBase(r)} 12 | }) 13 | } 14 | 15 | // Get returns data about a previously created Network. 16 | func Get(client *gophercloud.ServiceClient, id string) (r GetResult) { 17 | _, r.Err = client.Get(getURL(client, id), &r.Body, nil) 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /openstack/blockstorage/extensions/volumetenants/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package volumetenants provides the ability to extend a volume result with 3 | tenant/project information. Example: 4 | 5 | type VolumeWithTenant struct { 6 | volumes.Volume 7 | volumetenants.VolumeTenantExt 8 | } 9 | 10 | var allVolumes []VolumeWithTenant 11 | 12 | allPages, err := volumes.List(client, nil).AllPages() 13 | if err != nil { 14 | panic("Unable to retrieve volumes: %s", err) 15 | } 16 | 17 | err = volumes.ExtractVolumesInto(allPages, &allVolumes) 18 | if err != nil { 19 | panic("Unable to extract volumes: %s", err) 20 | } 21 | 22 | for _, volume := range allVolumes { 23 | fmt.Println(volume.TenantID) 24 | } 25 | */ 26 | package volumetenants 27 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/evacuate/results.go: -------------------------------------------------------------------------------- 1 | package evacuate 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // EvacuateResult is the response from an Evacuate operation. 8 | //Call its ExtractAdminPass method to retrieve the admin password of the instance. 9 | //The admin password will be an empty string if the cloud is not configured to inject admin passwords.. 10 | type EvacuateResult struct { 11 | gophercloud.Result 12 | } 13 | 14 | func (r EvacuateResult) ExtractAdminPass() (string, error) { 15 | var s struct { 16 | AdminPass string `json:"adminPass"` 17 | } 18 | err := r.ExtractInto(&s) 19 | if err != nil && err.Error() == "EOF" { 20 | return "", nil 21 | } 22 | return s.AdminPass, err 23 | } 24 | -------------------------------------------------------------------------------- /openstack/sharedfilesystems/v2/shares/urls.go: -------------------------------------------------------------------------------- 1 | package shares 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func createURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("shares") 7 | } 8 | 9 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 10 | return c.ServiceURL("shares", id) 11 | } 12 | 13 | func getURL(c *gophercloud.ServiceClient, id string) string { 14 | return c.ServiceURL("shares", id) 15 | } 16 | 17 | func getExportLocationsURL(c *gophercloud.ServiceClient, id string) string { 18 | return c.ServiceURL("shares", id, "export_locations") 19 | } 20 | 21 | func grantAccessURL(c *gophercloud.ServiceClient, id string) string { 22 | return c.ServiceURL("shares", id, "action") 23 | } 24 | -------------------------------------------------------------------------------- /script/bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script helps new contributors set up their local workstation for 4 | # gophercloud development and contributions. 5 | 6 | # Create the environment 7 | export GOPATH=$HOME/go/gophercloud 8 | mkdir -p $GOPATH 9 | 10 | # Download gophercloud into that environment 11 | go get github.com/gophercloud/gophercloud 12 | cd $GOPATH/src/github.com/gophercloud/gophercloud 13 | git checkout master 14 | 15 | # Write out the env.sh convenience file. 16 | cd $GOPATH 17 | cat <env.sh 18 | #!/bin/bash 19 | export GOPATH=$(pwd) 20 | export GOPHERCLOUD=$GOPATH/src/github.com/gophercloud/gophercloud 21 | EOF 22 | chmod a+x env.sh 23 | 24 | # Make changes immediately available as a convenience. 25 | . ./env.sh 26 | -------------------------------------------------------------------------------- /openstack/cdn/v1/serviceassets/testing/fixtures.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "net/http" 5 | "testing" 6 | 7 | th "github.com/gophercloud/gophercloud/testhelper" 8 | fake "github.com/gophercloud/gophercloud/testhelper/client" 9 | ) 10 | 11 | // HandleDeleteCDNAssetSuccessfully creates an HTTP handler at `/services/{id}/assets` on the test handler mux 12 | // that responds with a `Delete` response. 13 | func HandleDeleteCDNAssetSuccessfully(t *testing.T) { 14 | th.Mux.HandleFunc("/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0/assets", func(w http.ResponseWriter, r *http.Request) { 15 | th.TestMethod(t, r, "DELETE") 16 | th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) 17 | w.WriteHeader(http.StatusAccepted) 18 | }) 19 | } 20 | -------------------------------------------------------------------------------- /openstack/vpc/v1/publicips/urls.go: -------------------------------------------------------------------------------- 1 | package publicips 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func CreateURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("publicips") 9 | } 10 | 11 | func DeleteURL(c *gophercloud.ServiceClient, publicipId string) string { 12 | return c.ServiceURL("publicips", publicipId) 13 | } 14 | 15 | func GetURL(c *gophercloud.ServiceClient, publicipId string) string { 16 | return c.ServiceURL("publicips", publicipId) 17 | } 18 | 19 | func ListURL(c *gophercloud.ServiceClient) string { 20 | return c.ServiceURL("publicips") 21 | } 22 | 23 | func UpdateURL(c *gophercloud.ServiceClient, publicipId string) string { 24 | return c.ServiceURL("publicips", publicipId) 25 | } 26 | -------------------------------------------------------------------------------- /openstack/ces/v1/quotas/results.go: -------------------------------------------------------------------------------- 1 | package quotas 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // This is a auto create Response Object 8 | type Quota struct { 9 | Quotas Quotas `json:"quotas"` 10 | } 11 | 12 | type Quotas struct { 13 | Resources []Resource `json:"resources"` 14 | } 15 | 16 | type Resource struct { 17 | // 配额总数。 18 | Quota int `json:"quota"` 19 | // 配额类型。 枚举值说明: alarm,告警规则 20 | Type string `json:"type"` 21 | // 单位。 22 | Unit string `json:"unit"` 23 | // 已使用配额数。 24 | Used int `json:"used"` 25 | } 26 | 27 | type GetResult struct { 28 | gophercloud.Result 29 | } 30 | 31 | func (r GetResult) Extract() (*Quota, error) { 32 | var s *Quota 33 | err := r.ExtractInto(&s) 34 | return s, err 35 | } 36 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/tenantnetworks/requests.go: -------------------------------------------------------------------------------- 1 | package tenantnetworks 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List returns a Pager that allows you to iterate over a collection of Networks. 9 | func List(client *gophercloud.ServiceClient) pagination.Pager { 10 | return pagination.NewPager(client, listURL(client), func(r pagination.PageResult) pagination.Page { 11 | return NetworkPage{pagination.SinglePageBase(r)} 12 | }) 13 | } 14 | 15 | // Get returns data about a previously created Network. 16 | func Get(client *gophercloud.ServiceClient, id string) (r GetResult) { 17 | _, r.Err = client.Get(getURL(client, id), &r.Body, nil) 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /openstack/iam/v3/users/urls.go: -------------------------------------------------------------------------------- 1 | package users 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | // 查询用户详情 6 | func queryUserDetailUrl(client *gophercloud.ServiceClient, userId string) string { 7 | return client.ServiceURL("OS-USER", "users", userId) 8 | } 9 | 10 | // 创建用户 11 | func createUserUrl(client *gophercloud.ServiceClient) string { 12 | return client.ServiceURL("OS-USER", "users") 13 | } 14 | 15 | // 更新用户信息 16 | func updateUserInfoUrl(client *gophercloud.ServiceClient, userId string) string { 17 | return client.ServiceURL("OS-USER", "users", userId, "info") 18 | } 19 | 20 | // 更新用户信息 21 | func updateUserUrl(client *gophercloud.ServiceClient, userId string) string { 22 | return client.ServiceURL("OS-USER", "users", userId) 23 | } 24 | -------------------------------------------------------------------------------- /testing/endpoint_search_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud" 7 | th "github.com/gophercloud/gophercloud/testhelper" 8 | ) 9 | 10 | func TestApplyDefaultsToEndpointOpts(t *testing.T) { 11 | eo := gophercloud.EndpointOpts{Availability: gophercloud.AvailabilityPublic} 12 | eo.ApplyDefaults("compute") 13 | expected := gophercloud.EndpointOpts{Availability: gophercloud.AvailabilityPublic, Type: "compute"} 14 | th.CheckDeepEquals(t, expected, eo) 15 | 16 | eo = gophercloud.EndpointOpts{Type: "compute"} 17 | eo.ApplyDefaults("object-store") 18 | expected = gophercloud.EndpointOpts{Availability: gophercloud.AvailabilityPublic, Type: "compute"} 19 | th.CheckDeepEquals(t, expected, eo) 20 | } 21 | -------------------------------------------------------------------------------- /openstack/identity/v2/tenants/urls.go: -------------------------------------------------------------------------------- 1 | package tenants 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(client *gophercloud.ServiceClient) string { 6 | return client.ServiceURL("tenants") 7 | } 8 | 9 | func getURL(client *gophercloud.ServiceClient, tenantID string) string { 10 | return client.ServiceURL("tenants", tenantID) 11 | } 12 | 13 | func createURL(client *gophercloud.ServiceClient) string { 14 | return client.ServiceURL("tenants") 15 | } 16 | 17 | func deleteURL(client *gophercloud.ServiceClient, tenantID string) string { 18 | return client.ServiceURL("tenants", tenantID) 19 | } 20 | 21 | func updateURL(client *gophercloud.ServiceClient, tenantID string) string { 22 | return client.ServiceURL("tenants", tenantID) 23 | } 24 | -------------------------------------------------------------------------------- /openstack/identity/v3/services/urls.go: -------------------------------------------------------------------------------- 1 | package services 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(client *gophercloud.ServiceClient) string { 6 | return client.ServiceURL("services") 7 | } 8 | 9 | func createURL(client *gophercloud.ServiceClient) string { 10 | return client.ServiceURL("services") 11 | } 12 | 13 | func serviceURL(client *gophercloud.ServiceClient, serviceID string) string { 14 | return client.ServiceURL("services", serviceID) 15 | } 16 | 17 | func updateURL(client *gophercloud.ServiceClient, serviceID string) string { 18 | return client.ServiceURL("services", serviceID) 19 | } 20 | 21 | func getCatalogURL(client *gophercloud.ServiceClient) string { 22 | return client.ServiceURL("auth", "catalog") 23 | } 24 | -------------------------------------------------------------------------------- /openstack/vpc/v1/subnets/urls.go: -------------------------------------------------------------------------------- 1 | package subnets 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("subnets") 7 | } 8 | 9 | func CreateURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL("subnets") 11 | } 12 | 13 | func DeleteURL(c *gophercloud.ServiceClient, vpcId string, subnetId string) string { 14 | return c.ServiceURL("vpcs", vpcId, "subnets", subnetId) 15 | } 16 | 17 | func GetURL(c *gophercloud.ServiceClient, subnetId string) string { 18 | return c.ServiceURL("subnets", subnetId) 19 | } 20 | 21 | func UpdateURL(c *gophercloud.ServiceClient, vpcId string, subnetId string) string { 22 | return c.ServiceURL("vpcs", vpcId, "subnets", subnetId) 23 | } 24 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/usage/testing/requests_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/usage" 7 | th "github.com/gophercloud/gophercloud/testhelper" 8 | "github.com/gophercloud/gophercloud/testhelper/client" 9 | ) 10 | 11 | func TestGetTenant(t *testing.T) { 12 | var getOpts usage.SingleTenantOpts 13 | th.SetupHTTP() 14 | defer th.TeardownHTTP() 15 | HandleGetSingleTenantSuccessfully(t) 16 | page, err := usage.SingleTenant(client.ServiceClient(), FirstTenantID, getOpts).AllPages() 17 | th.AssertNoErr(t, err) 18 | actual, err := usage.ExtractSingleTenant(page) 19 | th.AssertNoErr(t, err) 20 | th.CheckDeepEquals(t, &SingleTenantUsageResults, actual) 21 | } 22 | -------------------------------------------------------------------------------- /openstack/as/v1/tags/urls.go: -------------------------------------------------------------------------------- 1 | package tags 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func ListResourceTagsURL(c *gophercloud.ServiceClient, resourceType string, resourceId string) string { 8 | return c.ServiceURL(resourceType, resourceId, "tags") 9 | } 10 | 11 | func ListTenantTagsURL(c *gophercloud.ServiceClient, resourceType string) string { 12 | return c.ServiceURL(resourceType, "tags") 13 | } 14 | 15 | func ListInstanceTagsURL(c *gophercloud.ServiceClient, resourceType string) string { 16 | return c.ServiceURL(resourceType, "resource_instances", "action") 17 | } 18 | 19 | func UpdateURL(c *gophercloud.ServiceClient, resourceType string, resourceId string) string { 20 | return c.ServiceURL(resourceType, resourceId, "tags", "action") 21 | } 22 | -------------------------------------------------------------------------------- /functiontest/fgs/Common/common.go: -------------------------------------------------------------------------------- 1 | package Common 2 | 3 | import ( 4 | "fmt" 5 | "encoding/json" 6 | "github.com/gophercloud/gophercloud" 7 | ) 8 | 9 | //打印結果 10 | func Show(v interface{}) { 11 | f, err := json.Marshal(v) 12 | if err != nil { 13 | fmt.Printf("Show %s has err : %s", v, err) 14 | } 15 | fmt.Println("Result:", string(f)) 16 | } 17 | 18 | func CheckErr(err error) bool { 19 | if err != nil { 20 | if ue, ok := err.(*gophercloud.UnifiedError); ok { 21 | fmt.Printf("Fail! \n[ ErrCode:%s \n Message:%s ] \n", ue.ErrorCode(), ue.Message()) 22 | return true 23 | } else { 24 | fmt.Printf("Err::%s \n", err) 25 | return true 26 | } 27 | } 28 | return false 29 | } 30 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/tenantnetworks/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package tenantnetworks provides the ability for tenants to see information 3 | about the networks they have access to. 4 | 5 | This is a deprecated API and will be removed from the Nova API service in a 6 | future version. 7 | 8 | This API works in both Neutron and nova-network based OpenStack clouds. 9 | 10 | Example to List Networks Available to a Tenant 11 | 12 | allPages, err := tenantnetworks.List(computeClient).AllPages() 13 | if err != nil { 14 | panic(err) 15 | } 16 | 17 | allNetworks, err := tenantnetworks.ExtractNetworks(allPages) 18 | if err != nil { 19 | panic(err) 20 | } 21 | 22 | for _, network := range allNetworks { 23 | fmt.Printf("%+v\n", network) 24 | } 25 | */ 26 | package tenantnetworks 27 | -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/availabilityzones/testing/requests_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | az "github.com/gophercloud/gophercloud/openstack/blockstorage/v2/extensions/availabilityzones" 7 | th "github.com/gophercloud/gophercloud/testhelper" 8 | "github.com/gophercloud/gophercloud/testhelper/client" 9 | ) 10 | 11 | // Verifies that availability zones can be listed correctly 12 | func TestList(t *testing.T) { 13 | th.SetupHTTP() 14 | defer th.TeardownHTTP() 15 | 16 | HandleGetSuccessfully(t) 17 | 18 | allPages, err := az.List(client.ServiceClient()).AllPages() 19 | th.AssertNoErr(t, err) 20 | 21 | actual, err := az.ExtractAvailabilityZones(allPages) 22 | th.AssertNoErr(t, err) 23 | 24 | th.CheckDeepEquals(t, AZResult, actual) 25 | } 26 | -------------------------------------------------------------------------------- /openstack/common/extensions/requests.go: -------------------------------------------------------------------------------- 1 | package extensions 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // Get retrieves information for a specific extension using its alias. 9 | func Get(c *gophercloud.ServiceClient, alias string) (r GetResult) { 10 | _, r.Err = c.Get(ExtensionURL(c, alias), &r.Body, nil) 11 | return 12 | } 13 | 14 | // List returns a Pager which allows you to iterate over the full collection of extensions. 15 | // It does not accept query parameters. 16 | func List(c *gophercloud.ServiceClient) pagination.Pager { 17 | return pagination.NewPager(c, ListExtensionURL(c), func(r pagination.PageResult) pagination.Page { 18 | return ExtensionPage{pagination.SinglePageBase(r)} 19 | }) 20 | } 21 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/snapshots/urls.go: -------------------------------------------------------------------------------- 1 | package snapshots 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func createURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("snapshots") 7 | } 8 | 9 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 10 | return c.ServiceURL("snapshots", id) 11 | } 12 | 13 | func getURL(c *gophercloud.ServiceClient, id string) string { 14 | return deleteURL(c, id) 15 | } 16 | 17 | func listURL(c *gophercloud.ServiceClient) string { 18 | return createURL(c) 19 | } 20 | 21 | func metadataURL(c *gophercloud.ServiceClient, id string) string { 22 | return c.ServiceURL("snapshots", id, "metadata") 23 | } 24 | 25 | func updateMetadataURL(c *gophercloud.ServiceClient, id string) string { 26 | return metadataURL(c, id) 27 | } 28 | -------------------------------------------------------------------------------- /openstack/blockstorage/v3/snapshots/urls.go: -------------------------------------------------------------------------------- 1 | package snapshots 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func createURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("snapshots") 7 | } 8 | 9 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 10 | return c.ServiceURL("snapshots", id) 11 | } 12 | 13 | func getURL(c *gophercloud.ServiceClient, id string) string { 14 | return deleteURL(c, id) 15 | } 16 | 17 | func listURL(c *gophercloud.ServiceClient) string { 18 | return createURL(c) 19 | } 20 | 21 | func metadataURL(c *gophercloud.ServiceClient, id string) string { 22 | return c.ServiceURL("snapshots", id, "metadata") 23 | } 24 | 25 | func updateMetadataURL(c *gophercloud.ServiceClient, id string) string { 26 | return metadataURL(c, id) 27 | } 28 | -------------------------------------------------------------------------------- /openstack/ecs/v1/cloudserversext/results.go: -------------------------------------------------------------------------------- 1 | package cloudserversext 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud/openstack/ecs/v1/cloudservers" 5 | ) 6 | 7 | //在server结构上加上了相关bss(Charging)信息及相关volume(VolumeAttached)信息 8 | type CloudServerExt struct { 9 | 10 | CloudServer *cloudservers.CloudServer 11 | 12 | //volume attached new 13 | VolumeAttached []VolumeInfo 14 | 15 | //云服务器计费信息 new 16 | Charging Charging 17 | } 18 | 19 | 20 | type Charging struct { 21 | //0代表按需计费、1代表包周期计费 22 | ChargingMode string 23 | 24 | //ChargingMode为1时有效 new 25 | ValidTime string 26 | 27 | //ChargingMode为1时有效 new 28 | ExpireTime string 29 | } 30 | 31 | type VolumeInfo struct { 32 | //卷的uuid 33 | ID string 34 | 35 | //云硬盘类型 36 | VolumeType string 37 | 38 | //云硬盘大小 39 | Size int 40 | } 41 | -------------------------------------------------------------------------------- /acceptance/openstack/sharedfilesystems/v2/shares_test.go: -------------------------------------------------------------------------------- 1 | package v2 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud/acceptance/clients" 7 | "github.com/gophercloud/gophercloud/openstack/sharedfilesystems/v2/shares" 8 | ) 9 | 10 | func TestShareCreate(t *testing.T) { 11 | client, err := clients.NewSharedFileSystemV2Client() 12 | if err != nil { 13 | t.Fatalf("Unable to create a sharedfs client: %v", err) 14 | } 15 | 16 | share, err := CreateShare(t, client) 17 | if err != nil { 18 | t.Fatalf("Unable to create a share: %v", err) 19 | } 20 | 21 | defer DeleteShare(t, client, share) 22 | 23 | created, err := shares.Get(client, share.ID).Extract() 24 | if err != nil { 25 | t.Errorf("Unable to retrieve share: %v", err) 26 | } 27 | PrintShare(t, created) 28 | } 29 | -------------------------------------------------------------------------------- /openstack/blockstorage/v1/apiversions/requests.go: -------------------------------------------------------------------------------- 1 | package apiversions 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List lists all the Cinder API versions available to end-users. 9 | func List(c *gophercloud.ServiceClient) pagination.Pager { 10 | return pagination.NewPager(c, listURL(c), func(r pagination.PageResult) pagination.Page { 11 | return APIVersionPage{pagination.SinglePageBase(r)} 12 | }) 13 | } 14 | 15 | // Get will retrieve the volume type with the provided ID. To extract the volume 16 | // type from the result, call the Extract method on the GetResult. 17 | func Get(client *gophercloud.ServiceClient, v string) (r GetResult) { 18 | _, r.Err = client.Get(getURL(client, v), &r.Body, nil) 19 | return 20 | } 21 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/lockunlock/requests.go: -------------------------------------------------------------------------------- 1 | package lockunlock 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func actionURL(client *gophercloud.ServiceClient, id string) string { 6 | return client.ServiceURL("servers", id, "action") 7 | } 8 | 9 | // Lock is the operation responsible for locking a Compute server. 10 | func Lock(client *gophercloud.ServiceClient, id string) (r LockResult) { 11 | _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"lock": nil}, nil, nil) 12 | return 13 | } 14 | 15 | // Unlock is the operation responsible for unlocking a Compute server. 16 | func Unlock(client *gophercloud.ServiceClient, id string) (r UnlockResult) { 17 | _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"unlock": nil}, nil, nil) 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /openstack/imageservice/v2/imagedata/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package imagedata enables management of image data. 3 | 4 | Example to Upload Image Data 5 | 6 | imageID := "da3b75d9-3f4a-40e7-8a2c-bfab23927dea" 7 | 8 | imageData, err := os.Open("/path/to/image/file") 9 | if err != nil { 10 | panic(err) 11 | } 12 | defer imageData.Close() 13 | 14 | err = imagedata.Upload(imageClient, imageID, imageData).ExtractErr() 15 | if err != nil { 16 | panic(err) 17 | } 18 | 19 | Example to Download Image Data 20 | 21 | imageID := "da3b75d9-3f4a-40e7-8a2c-bfab23927dea" 22 | 23 | image, err := imagedata.Download(imageClient, imageID).Extract() 24 | if err != nil { 25 | panic(err) 26 | } 27 | 28 | imageData, err := ioutil.ReadAll(image) 29 | if err != nil { 30 | panic(err) 31 | } 32 | */ 33 | package imagedata 34 | -------------------------------------------------------------------------------- /openstack/objectstorage/v1/swauth/testing/requests_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud/openstack" 7 | "github.com/gophercloud/gophercloud/openstack/objectstorage/v1/swauth" 8 | th "github.com/gophercloud/gophercloud/testhelper" 9 | ) 10 | 11 | func TestAuth(t *testing.T) { 12 | authOpts := swauth.AuthOpts{ 13 | User: "test:tester", 14 | Key: "testing", 15 | } 16 | 17 | th.SetupHTTP() 18 | defer th.TeardownHTTP() 19 | HandleAuthSuccessfully(t, authOpts) 20 | 21 | providerClient, err := openstack.NewClient(th.Endpoint()) 22 | th.AssertNoErr(t, err) 23 | 24 | swiftClient, err := swauth.NewObjectStorageV1(providerClient, authOpts) 25 | th.AssertNoErr(t, err) 26 | th.AssertEquals(t, swiftClient.TokenID, AuthResult.Token) 27 | } 28 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/resetstate/requests.go: -------------------------------------------------------------------------------- 1 | package resetstate 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // ServerState refers to the states usable in ResetState Action 8 | type ServerState string 9 | 10 | const ( 11 | // StateActive returns the state of the server as active 12 | StateActive ServerState = "active" 13 | 14 | // StateError returns the state of the server as error 15 | StateError ServerState = "error" 16 | ) 17 | 18 | // ResetState will reset the state of a server 19 | func ResetState(client *gophercloud.ServiceClient, id string, state ServerState) (r ResetResult) { 20 | stateMap := map[string]interface{}{"state": state} 21 | _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"os-resetState": stateMap}, nil, nil) 22 | return 23 | } 24 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/attachinterfaces/urls.go: -------------------------------------------------------------------------------- 1 | package attachinterfaces 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func listInterfaceURL(client *gophercloud.ServiceClient, serverID string) string { 6 | return client.ServiceURL("servers", serverID, "os-interface") 7 | } 8 | 9 | func getInterfaceURL(client *gophercloud.ServiceClient, serverID, portID string) string { 10 | return client.ServiceURL("servers", serverID, "os-interface", portID) 11 | } 12 | 13 | func createInterfaceURL(client *gophercloud.ServiceClient, serverID string) string { 14 | return client.ServiceURL("servers", serverID, "os-interface") 15 | } 16 | func deleteInterfaceURL(client *gophercloud.ServiceClient, serverID, portID string) string { 17 | return client.ServiceURL("servers", serverID, "os-interface", portID) 18 | } 19 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/extendedstatus/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package extendedstatus provides the ability to extend a server result with 3 | the extended status information. Example: 4 | 5 | type ServerWithExt struct { 6 | servers.Server 7 | extendedstatus.ServerExtendedStatusExt 8 | } 9 | 10 | var allServers []ServerWithExt 11 | 12 | allPages, err := servers.List(client, nil).AllPages() 13 | if err != nil { 14 | panic("Unable to retrieve servers: %s", err) 15 | } 16 | 17 | err = servers.ExtractServersInto(allPages, &allServers) 18 | if err != nil { 19 | panic("Unable to extract servers: %s", err) 20 | } 21 | 22 | for _, server := range allServers { 23 | fmt.Println(server.TaskState) 24 | fmt.Println(server.VmState) 25 | fmt.Println(server.PowerState) 26 | } 27 | */ 28 | package extendedstatus 29 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/startstop/requests.go: -------------------------------------------------------------------------------- 1 | package startstop 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func actionURL(client *gophercloud.ServiceClient, id string) string { 6 | return client.ServiceURL("servers", id, "action") 7 | } 8 | 9 | // Start is the operation responsible for starting a Compute server. 10 | func Start(client *gophercloud.ServiceClient, id string) (r StartResult) { 11 | _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"os-start": nil}, nil, nil) 12 | return 13 | } 14 | 15 | 16 | // Stop is the operation responsible for stopping a Compute server. 17 | func Stop(client *gophercloud.ServiceClient, id string) (r StopResult) { 18 | _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"os-stop": nil}, nil, nil) 19 | return 20 | } 21 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas/pools/urls.go: -------------------------------------------------------------------------------- 1 | package pools 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "lb" 7 | resourcePath = "pools" 8 | monitorPath = "health_monitors" 9 | ) 10 | 11 | func rootURL(c *gophercloud.ServiceClient) string { 12 | return c.ServiceURL(rootPath, resourcePath) 13 | } 14 | 15 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 16 | return c.ServiceURL(rootPath, resourcePath, id) 17 | } 18 | 19 | func associateURL(c *gophercloud.ServiceClient, id string) string { 20 | return c.ServiceURL(rootPath, resourcePath, id, monitorPath) 21 | } 22 | 23 | func disassociateURL(c *gophercloud.ServiceClient, poolID, monitorID string) string { 24 | return c.ServiceURL(rootPath, resourcePath, poolID, monitorPath, monitorID) 25 | } 26 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/aggregates/urls.go: -------------------------------------------------------------------------------- 1 | package aggregates 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func aggregatesListURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("os-aggregates") 7 | } 8 | 9 | func aggregatesCreateURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL("os-aggregates") 11 | } 12 | 13 | func aggregatesDeleteURL(c *gophercloud.ServiceClient, aggregateID string) string { 14 | return c.ServiceURL("os-aggregates", aggregateID) 15 | } 16 | 17 | func aggregatesGetURL(c *gophercloud.ServiceClient, aggregateID string) string { 18 | return c.ServiceURL("os-aggregates", aggregateID) 19 | } 20 | 21 | func aggregatesUpdateURL(c *gophercloud.ServiceClient, aggregateID string) string { 22 | return c.ServiceURL("os-aggregates", aggregateID) 23 | } 24 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/pauseunpause/requests.go: -------------------------------------------------------------------------------- 1 | package pauseunpause 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func actionURL(client *gophercloud.ServiceClient, id string) string { 6 | return client.ServiceURL("servers", id, "action") 7 | } 8 | 9 | // Pause is the operation responsible for pausing a Compute server. 10 | func Pause(client *gophercloud.ServiceClient, id string) (r PauseResult) { 11 | _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"pause": nil}, nil, nil) 12 | return 13 | } 14 | 15 | // Unpause is the operation responsible for unpausing a Compute server. 16 | func Unpause(client *gophercloud.ServiceClient, id string) (r UnpauseResult) { 17 | _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"unpause": nil}, nil, nil) 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /testhelper/fixture/helper.go: -------------------------------------------------------------------------------- 1 | package fixture 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "testing" 7 | 8 | th "github.com/gophercloud/gophercloud/testhelper" 9 | "github.com/gophercloud/gophercloud/testhelper/client" 10 | ) 11 | 12 | func SetupHandler(t *testing.T, url, method, requestBody, responseBody string, status int) { 13 | th.Mux.HandleFunc(url, func(w http.ResponseWriter, r *http.Request) { 14 | th.TestMethod(t, r, method) 15 | th.TestHeader(t, r, "X-Auth-Token", client.TokenID) 16 | 17 | if requestBody != "" { 18 | th.TestJSONRequest(t, r, requestBody) 19 | } 20 | 21 | if responseBody != "" { 22 | w.Header().Add("Content-Type", "application/json") 23 | } 24 | 25 | w.WriteHeader(status) 26 | 27 | if responseBody != "" { 28 | fmt.Fprintf(w, responseBody) 29 | } 30 | }) 31 | } 32 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/fwaas/policies/urls.go: -------------------------------------------------------------------------------- 1 | package policies 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "fw" 7 | resourcePath = "firewall_policies" 8 | insertPath = "insert_rule" 9 | removePath = "remove_rule" 10 | ) 11 | 12 | func rootURL(c *gophercloud.ServiceClient) string { 13 | return c.ServiceURL(rootPath, resourcePath) 14 | } 15 | 16 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 17 | return c.ServiceURL(rootPath, resourcePath, id) 18 | } 19 | 20 | func insertURL(c *gophercloud.ServiceClient, id string) string { 21 | return c.ServiceURL(rootPath, resourcePath, id, insertPath) 22 | } 23 | 24 | func removeURL(c *gophercloud.ServiceClient, id string) string { 25 | return c.ServiceURL(rootPath, resourcePath, id, removePath) 26 | } 27 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/loadbalancers/urls.go: -------------------------------------------------------------------------------- 1 | package loadbalancers 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "lbaas" 7 | resourcePath = "loadbalancers" 8 | statusPath = "statuses" 9 | statsPath = "stats" 10 | ) 11 | 12 | func rootURL(c *gophercloud.ServiceClient) string { 13 | return c.ServiceURL(rootPath, resourcePath) 14 | } 15 | 16 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 17 | return c.ServiceURL(rootPath, resourcePath, id) 18 | } 19 | 20 | func statusRootURL(c *gophercloud.ServiceClient, id string) string { 21 | return c.ServiceURL(rootPath, resourcePath, id, statusPath) 22 | } 23 | 24 | func statsRootURL(c *gophercloud.ServiceClient,id string)string{ 25 | return c.ServiceURL(rootPath,resourcePath,id,statsPath) 26 | } 27 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/buildinfo/results.go: -------------------------------------------------------------------------------- 1 | package buildinfo 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | // Revision represents the API/Engine revision of a Heat deployment. 8 | type Revision struct { 9 | Revision string `json:"revision"` 10 | } 11 | 12 | // BuildInfo represents the build information for a Heat deployment. 13 | type BuildInfo struct { 14 | API Revision `json:"api"` 15 | Engine Revision `json:"engine"` 16 | } 17 | 18 | // GetResult represents the result of a Get operation. 19 | type GetResult struct { 20 | gophercloud.Result 21 | } 22 | 23 | // Extract returns a pointer to a BuildInfo object and is called after a 24 | // Get operation. 25 | func (r GetResult) Extract() (*BuildInfo, error) { 26 | var s *BuildInfo 27 | err := r.ExtractInto(&s) 28 | return s, err 29 | } 30 | -------------------------------------------------------------------------------- /openstack/tms/v1/predefinetags/results.go: -------------------------------------------------------------------------------- 1 | package predefinetags 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | 9 | type commonResult struct { 10 | gophercloud.Result 11 | } 12 | 13 | type ErrorResult struct { 14 | gophercloud.ErrResult 15 | } 16 | 17 | type TagResp struct { 18 | Key string `q:"key"` 19 | Value string `q:"value"` 20 | Update_Time string `q:"update_time"` 21 | } 22 | 23 | func ExtractTags(r pagination.Page) ([]TagResp, error) { 24 | var s struct { 25 | Tags []TagResp `json:"tags"` 26 | } 27 | err := r.(ListPage).ExtractInto(&s) 28 | return s.Tags, err 29 | } 30 | 31 | func (r ErrorResult) Extract() (*Tag, error) { 32 | var response Tag 33 | err := r.ExtractInto(&response) 34 | return &response, err 35 | } -------------------------------------------------------------------------------- /openstack/as/v1/configures/urls.go: -------------------------------------------------------------------------------- 1 | package configures 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | func CreateURL(c *gophercloud.ServiceClient) string { 8 | return c.ServiceURL("scaling_configuration") 9 | } 10 | 11 | func DeleteURL(c *gophercloud.ServiceClient, scalingConfigurationId string) string { 12 | return c.ServiceURL("scaling_configuration", scalingConfigurationId) 13 | } 14 | 15 | func DeleteWithBatchURL(c *gophercloud.ServiceClient) string { 16 | return c.ServiceURL("scaling_configurations") 17 | } 18 | 19 | func GetURL(c *gophercloud.ServiceClient, scalingConfigurationId string) string { 20 | return c.ServiceURL("scaling_configuration", scalingConfigurationId) 21 | } 22 | 23 | func ListURL(c *gophercloud.ServiceClient) string { 24 | return c.ServiceURL("scaling_configuration") 25 | } 26 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/suspendresume/requests.go: -------------------------------------------------------------------------------- 1 | package suspendresume 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func actionURL(client *gophercloud.ServiceClient, id string) string { 6 | return client.ServiceURL("servers", id, "action") 7 | } 8 | 9 | // Suspend is the operation responsible for suspending a Compute server. 10 | func Suspend(client *gophercloud.ServiceClient, id string) (r SuspendResult) { 11 | _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"suspend": nil}, nil, nil) 12 | return 13 | } 14 | 15 | // Resume is the operation responsible for resuming a Compute server. 16 | func Resume(client *gophercloud.ServiceClient, id string) (r UnsuspendResult) { 17 | _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"resume": nil}, nil, nil) 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/usage/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package usage provides information and interaction with the 3 | SimpleTenantUsage extension for the OpenStack Compute service. 4 | 5 | Example to Retrieve Usage for a Single Tenant: 6 | start := time.Date(2017, 01, 21, 10, 4, 20, 0, time.UTC) 7 | end := time.Date(2017, 01, 21, 10, 4, 20, 0, time.UTC) 8 | 9 | singleTenantOpts := usage.SingleTenantOpts{ 10 | Start: &start, 11 | End: &end, 12 | } 13 | 14 | page, err := usage.SingleTenant(computeClient, tenantID, singleTenantOpts).AllPages() 15 | if err != nil { 16 | panic(err) 17 | } 18 | 19 | tenantUsage, err := usage.ExtractSingleTenant(page) 20 | if err != nil { 21 | panic(err) 22 | } 23 | 24 | fmt.Printf("%+v\n", tenantUsage) 25 | 26 | */ 27 | package usage 28 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/lbaas_v2/pools/urls.go: -------------------------------------------------------------------------------- 1 | package pools 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | const ( 6 | rootPath = "lbaas" 7 | resourcePath = "pools" 8 | memberPath = "members" 9 | ) 10 | 11 | func rootURL(c *gophercloud.ServiceClient) string { 12 | return c.ServiceURL(rootPath, resourcePath) 13 | } 14 | 15 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 16 | return c.ServiceURL(rootPath, resourcePath, id) 17 | } 18 | 19 | func memberRootURL(c *gophercloud.ServiceClient, poolId string) string { 20 | return c.ServiceURL(rootPath, resourcePath, poolId, memberPath) 21 | } 22 | 23 | func memberResourceURL(c *gophercloud.ServiceClient, poolID string, memeberID string) string { 24 | return c.ServiceURL(rootPath, resourcePath, poolID, memberPath, memeberID) 25 | } 26 | -------------------------------------------------------------------------------- /openstack/bss/v1/customermanagement/url.go: -------------------------------------------------------------------------------- 1 | package customermanagement 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | 6 | // POST /v1.0/{partner_id}/partner/customer-mgr/check-user 7 | func getCheckCustomerRegisterInfoURL(client *gophercloud.ServiceClient, domainId string) string { 8 | return client.ServiceURL(domainId, "partner/customer-mgr/check-user") 9 | } 10 | 11 | // POST /v1.0/{partner_id}/partner/customer-mgr/customer 12 | func getCreateCustomerURL(client *gophercloud.ServiceClient, domainId string) string { 13 | return client.ServiceURL(domainId, "partner/customer-mgr/customer") 14 | } 15 | 16 | // POST /v1.0/{partner_id}/partner/customer-mgr/customer 17 | func getQueryCustomerURL(client *gophercloud.ServiceClient, domainId string) string { 18 | return client.ServiceURL(domainId, "partner/customer-mgr/query") 19 | } -------------------------------------------------------------------------------- /openstack/networking/v2/ports/urls.go: -------------------------------------------------------------------------------- 1 | package ports 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 6 | return c.ServiceURL("ports", id) 7 | } 8 | 9 | func rootURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL("ports") 11 | } 12 | 13 | func listURL(c *gophercloud.ServiceClient) string { 14 | return rootURL(c) 15 | } 16 | 17 | func getURL(c *gophercloud.ServiceClient, id string) string { 18 | return resourceURL(c, id) 19 | } 20 | 21 | func createURL(c *gophercloud.ServiceClient) string { 22 | return rootURL(c) 23 | } 24 | 25 | func updateURL(c *gophercloud.ServiceClient, id string) string { 26 | return resourceURL(c, id) 27 | } 28 | 29 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 30 | return resourceURL(c, id) 31 | } 32 | -------------------------------------------------------------------------------- /openstack/vpc/v2.0/bandwidths/urls.go: -------------------------------------------------------------------------------- 1 | package bandwidths 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func PostURL(c *gophercloud.ServiceClient) string { 6 | return c.ServiceURL("bandwidths") 7 | } 8 | 9 | func BatchPostURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL("batch-bandwidths") 11 | } 12 | func UpdateURL(c *gophercloud.ServiceClient, ID string) string { 13 | return c.ServiceURL("bandwidths", ID) 14 | } 15 | 16 | func DeleteURL(c *gophercloud.ServiceClient, ID string) string { 17 | return c.ServiceURL("bandwidths", ID) 18 | } 19 | 20 | func InsertURL(c *gophercloud.ServiceClient, ID string) string { 21 | return c.ServiceURL("bandwidths", ID, "insert") 22 | } 23 | 24 | func RemoveURL(c *gophercloud.ServiceClient, ID string) string { 25 | return c.ServiceURL("bandwidths", ID, "remove") 26 | } 27 | -------------------------------------------------------------------------------- /openstack/db/v1/flavors/requests.go: -------------------------------------------------------------------------------- 1 | package flavors 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List will list all available hardware flavors that an instance can use. The 9 | // operation is identical to the one supported by the Nova API, but without the 10 | // "disk" property. 11 | func List(client *gophercloud.ServiceClient) pagination.Pager { 12 | return pagination.NewPager(client, listURL(client), func(r pagination.PageResult) pagination.Page { 13 | return FlavorPage{pagination.LinkedPageBase{PageResult: r}} 14 | }) 15 | } 16 | 17 | // Get will retrieve information for a specified hardware flavor. 18 | func Get(client *gophercloud.ServiceClient, id string) (r GetResult) { 19 | _, r.Err = client.Get(getURL(client, id), &r.Body, nil) 20 | return 21 | } 22 | -------------------------------------------------------------------------------- /openstack/imageservice/v2/imagedata/results.go: -------------------------------------------------------------------------------- 1 | package imagedata 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | 7 | "github.com/gophercloud/gophercloud" 8 | ) 9 | 10 | // UploadResult is the result of an upload image operation. Call its ExtractErr 11 | // method to determine if the request succeeded or failed. 12 | type UploadResult struct { 13 | gophercloud.ErrResult 14 | } 15 | 16 | // DownloadResult is the result of a download image operation. Call its Extract 17 | // method to gain access to the image data. 18 | type DownloadResult struct { 19 | gophercloud.Result 20 | } 21 | 22 | // Extract builds images model from io.Reader 23 | func (r DownloadResult) Extract() (io.Reader, error) { 24 | if r, ok := r.Body.(io.Reader); ok { 25 | return r, nil 26 | } 27 | return nil, fmt.Errorf("Expected io.Reader but got: %T(%#v)", r.Body, r.Body) 28 | } 29 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/stackevents/urls.go: -------------------------------------------------------------------------------- 1 | package stackevents 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func findURL(c *gophercloud.ServiceClient, stackName string) string { 6 | return c.ServiceURL("stacks", stackName, "events") 7 | } 8 | 9 | func listURL(c *gophercloud.ServiceClient, stackName, stackID string) string { 10 | return c.ServiceURL("stacks", stackName, stackID, "events") 11 | } 12 | 13 | func listResourceEventsURL(c *gophercloud.ServiceClient, stackName, stackID, resourceName string) string { 14 | return c.ServiceURL("stacks", stackName, stackID, "resources", resourceName, "events") 15 | } 16 | 17 | func getURL(c *gophercloud.ServiceClient, stackName, stackID, resourceName, eventID string) string { 18 | return c.ServiceURL("stacks", stackName, stackID, "resources", resourceName, "events", eventID) 19 | } 20 | -------------------------------------------------------------------------------- /openstack/orchestration/v1/stacks/errors.go: -------------------------------------------------------------------------------- 1 | package stacks 2 | 3 | /* 4 | import ( 5 | "fmt" 6 | 7 | "github.com/gophercloud/gophercloud" 8 | ) 9 | 10 | type ErrInvalidEnvironment struct { 11 | gophercloud.BaseError 12 | Section string 13 | } 14 | 15 | func (e ErrInvalidEnvironment) Error() string { 16 | return fmt.Sprintf("Environment has wrong section: %s", e.Section) 17 | } 18 | 19 | type ErrInvalidDataFormat struct { 20 | gophercloud.BaseError 21 | } 22 | 23 | func (e ErrInvalidDataFormat) Error() string { 24 | return fmt.Sprintf("Data in neither json nor yaml format.") 25 | } 26 | 27 | type ErrInvalidTemplateFormatVersion struct { 28 | gophercloud.BaseError 29 | Version string 30 | } 31 | 32 | func (e ErrInvalidTemplateFormatVersion) Error() string { 33 | return fmt.Sprintf("Template format version not found.") 34 | } 35 | */ 36 | -------------------------------------------------------------------------------- /openstack/imageservice/v2/imagedata/requests.go: -------------------------------------------------------------------------------- 1 | package imagedata 2 | 3 | import ( 4 | "io" 5 | "net/http" 6 | 7 | "github.com/gophercloud/gophercloud" 8 | ) 9 | 10 | // Upload uploads an image file. 11 | func Upload(client *gophercloud.ServiceClient, id string, data io.Reader) (r UploadResult) { 12 | _, r.Err = client.Put(uploadURL(client, id), data, nil, &gophercloud.RequestOpts{ 13 | MoreHeaders: map[string]string{"Content-Type": "application/octet-stream"}, 14 | OkCodes: []int{204}, 15 | }) 16 | return 17 | } 18 | 19 | // Download retrieves an image. 20 | func Download(client *gophercloud.ServiceClient, id string) (r DownloadResult) { 21 | var resp *http.Response 22 | resp, r.Err = client.Get(downloadURL(client, id), nil, nil) 23 | if resp != nil { 24 | r.Body = resp.Body 25 | r.Header = resp.Header 26 | } 27 | return 28 | } 29 | -------------------------------------------------------------------------------- /openstack/ims/v2/cloudimages/urls.go: -------------------------------------------------------------------------------- 1 | package cloudimages 2 | 3 | import ( 4 | "net/url" 5 | 6 | "github.com/gophercloud/gophercloud" 7 | ) 8 | 9 | func listURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL("cloudimages") 11 | } 12 | 13 | func createURL(c *gophercloud.ServiceClient) string { 14 | return c.ServiceURL("cloudimages/action") 15 | } 16 | 17 | func jobURL(c *gophercloud.ServiceClient, jobId string) string { 18 | return c.ServiceURL("jobs", jobId) 19 | } 20 | 21 | // builds next page full url based on current url 22 | func nextPageURL(currentURL string, next string) (string, error) { 23 | base, err := url.Parse(currentURL) 24 | if err != nil { 25 | return "", err 26 | } 27 | rel, err := url.Parse(next) 28 | if err != nil { 29 | return "", err 30 | } 31 | return base.ResolveReference(rel).String(), nil 32 | } 33 | -------------------------------------------------------------------------------- /openstack/networking/v2/subnets/urls.go: -------------------------------------------------------------------------------- 1 | package subnets 2 | 3 | import "github.com/gophercloud/gophercloud" 4 | 5 | func resourceURL(c *gophercloud.ServiceClient, id string) string { 6 | return c.ServiceURL("subnets", id) 7 | } 8 | 9 | func rootURL(c *gophercloud.ServiceClient) string { 10 | return c.ServiceURL("subnets") 11 | } 12 | 13 | func listURL(c *gophercloud.ServiceClient) string { 14 | return rootURL(c) 15 | } 16 | 17 | func getURL(c *gophercloud.ServiceClient, id string) string { 18 | return resourceURL(c, id) 19 | } 20 | 21 | func createURL(c *gophercloud.ServiceClient) string { 22 | return rootURL(c) 23 | } 24 | 25 | func updateURL(c *gophercloud.ServiceClient, id string) string { 26 | return resourceURL(c, id) 27 | } 28 | 29 | func deleteURL(c *gophercloud.ServiceClient, id string) string { 30 | return resourceURL(c, id) 31 | } 32 | -------------------------------------------------------------------------------- /openstack/vpc/v1/quotas/requests.go: -------------------------------------------------------------------------------- 1 | package quotas 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | ) 6 | 7 | type ListOpts struct { 8 | 9 | // Specifies the resource type. 10 | Type string `q:"type"` 11 | } 12 | 13 | type ListOptsBuilder interface { 14 | ToListQuery() (string, error) 15 | } 16 | 17 | func (opts ListOpts) ToListQuery() (string, error) { 18 | q, err := gophercloud.BuildQueryString(opts) 19 | return q.String(), err 20 | } 21 | 22 | func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) (r ListResult) { 23 | url := ListURL(client) 24 | if opts != nil { 25 | query, err := opts.ToListQuery() 26 | if err != nil { 27 | r.Err = err 28 | return 29 | } 30 | url += query 31 | } 32 | 33 | _, r.Err = client.Get(url, &r.Body, &gophercloud.RequestOpts{ 34 | OkCodes: []int{200}, 35 | }) 36 | return 37 | } 38 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/startstop/testing/requests_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/startstop" 7 | th "github.com/gophercloud/gophercloud/testhelper" 8 | "github.com/gophercloud/gophercloud/testhelper/client" 9 | ) 10 | 11 | const serverID = "{serverId}" 12 | 13 | func TestStart(t *testing.T) { 14 | th.SetupHTTP() 15 | defer th.TeardownHTTP() 16 | 17 | mockStartServerResponse(t, serverID) 18 | 19 | err := startstop.Start(client.ServiceClient(), serverID).ExtractErr() 20 | th.AssertNoErr(t, err) 21 | } 22 | 23 | func TestStop(t *testing.T) { 24 | th.SetupHTTP() 25 | defer th.TeardownHTTP() 26 | 27 | mockStopServerResponse(t, serverID) 28 | 29 | err := startstop.Stop(client.ServiceClient(), serverID).ExtractErr() 30 | th.AssertNoErr(t, err) 31 | } 32 | -------------------------------------------------------------------------------- /openstack/networking/v2/extensions/provider/requests.go: -------------------------------------------------------------------------------- 1 | package provider 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud/openstack/networking/v2/networks" 5 | ) 6 | 7 | // CreateOptsExt adds a Segments option to the base Network CreateOpts. 8 | type CreateOptsExt struct { 9 | networks.CreateOptsBuilder 10 | Segments []Segment `json:"segments,omitempty"` 11 | } 12 | 13 | // ToNetworkCreateMap adds segments to the base network creation options. 14 | func (opts CreateOptsExt) ToNetworkCreateMap() (map[string]interface{}, error) { 15 | base, err := opts.CreateOptsBuilder.ToNetworkCreateMap() 16 | if err != nil { 17 | return nil, err 18 | } 19 | 20 | if opts.Segments == nil { 21 | return base, nil 22 | } 23 | 24 | providerMap := base["network"].(map[string]interface{}) 25 | providerMap["segments"] = opts.Segments 26 | 27 | return base, nil 28 | } 29 | -------------------------------------------------------------------------------- /openstack/vpc/v2.0/routes/urls.go: -------------------------------------------------------------------------------- 1 | package routes 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "net/url" 6 | 7 | ) 8 | 9 | func CreateURL(c *gophercloud.ServiceClient) string { 10 | return baseURL(c) 11 | } 12 | 13 | func DeleteURL(c *gophercloud.ServiceClient, routeId string) string { 14 | return baseURLWithID(c,routeId) 15 | } 16 | 17 | func GetURL(c *gophercloud.ServiceClient, routeId string) string { 18 | return baseURLWithID(c,routeId) 19 | } 20 | 21 | func ListURL(c *gophercloud.ServiceClient) string { 22 | return baseURL(c) 23 | } 24 | 25 | func baseURL(c *gophercloud.ServiceClient) string { 26 | u, _ := url.Parse(c.ResourceBaseURL()) 27 | return u.Scheme + "://" + u.Host + "/v2.0/" + "vpc/routes" 28 | } 29 | 30 | func baseURLWithID(c *gophercloud.ServiceClient, routeId string) string { 31 | return baseURL(c) + "/" + routeId 32 | } 33 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/availabilityzones/requests.go: -------------------------------------------------------------------------------- 1 | package availabilityzones 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | // List will return the existing availability zones. 9 | func List(client *gophercloud.ServiceClient) pagination.Pager { 10 | return pagination.NewPager(client, listURL(client), func(r pagination.PageResult) pagination.Page { 11 | return AvailabilityZonePage{pagination.SinglePageBase(r)} 12 | }) 13 | } 14 | 15 | // ListDetail will return the existing availability zones with detailed information. 16 | func ListDetail(client *gophercloud.ServiceClient) pagination.Pager { 17 | return pagination.NewPager(client, listDetailURL(client), func(r pagination.PageResult) pagination.Page { 18 | return AvailabilityZonePage{pagination.SinglePageBase(r)} 19 | }) 20 | } 21 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/lockunlock/testing/request_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/lockunlock" 7 | th "github.com/gophercloud/gophercloud/testhelper" 8 | "github.com/gophercloud/gophercloud/testhelper/client" 9 | ) 10 | 11 | const serverID = "{serverId}" 12 | 13 | func TestLock(t *testing.T) { 14 | th.SetupHTTP() 15 | defer th.TeardownHTTP() 16 | 17 | mockStartServerResponse(t, serverID) 18 | 19 | err := lockunlock.Lock(client.ServiceClient(), serverID).ExtractErr() 20 | th.AssertNoErr(t, err) 21 | } 22 | 23 | func TestUnlock(t *testing.T) { 24 | th.SetupHTTP() 25 | defer th.TeardownHTTP() 26 | 27 | mockStopServerResponse(t, serverID) 28 | 29 | err := lockunlock.Unlock(client.ServiceClient(), serverID).ExtractErr() 30 | th.AssertNoErr(t, err) 31 | } 32 | -------------------------------------------------------------------------------- /openstack/compute/v2/extensions/volumeattach/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package volumeattach provides the ability to attach and detach volumes 3 | from servers. 4 | 5 | Example to Attach a Volume 6 | 7 | serverID := "7ac8686c-de71-4acb-9600-ec18b1a1ed6d" 8 | volumeID := "87463836-f0e2-4029-abf6-20c8892a3103" 9 | 10 | createOpts := volumeattach.CreateOpts{ 11 | Device: "/dev/vdc", 12 | VolumeID: volumeID, 13 | } 14 | 15 | result, err := volumeattach.Create(computeClient, serverID, createOpts).Extract() 16 | if err != nil { 17 | panic(err) 18 | } 19 | 20 | Example to Detach a Volume 21 | 22 | serverID := "7ac8686c-de71-4acb-9600-ec18b1a1ed6d" 23 | attachmentID := "ed081613-1c9b-4231-aa5e-ebfd4d87f983" 24 | 25 | err := volumeattach.Delete(computeClient, serverID, attachmentID).ExtractErr() 26 | if err != nil { 27 | panic(err) 28 | } 29 | */ 30 | package volumeattach 31 | -------------------------------------------------------------------------------- /openstack/rds/v3/datastores/results.go: -------------------------------------------------------------------------------- 1 | package datastores 2 | 3 | import ( 4 | "github.com/gophercloud/gophercloud" 5 | "github.com/gophercloud/gophercloud/pagination" 6 | ) 7 | 8 | type DataStoresResult struct { 9 | gophercloud.Result 10 | } 11 | type DataStores struct { 12 | DataStores []dataStores `json:"dataStores" ` 13 | } 14 | type dataStores struct { 15 | Id string `json:"id" ` 16 | Name string `json:"name"` 17 | } 18 | 19 | type DataStoresPage struct { 20 | pagination.Offset 21 | } 22 | 23 | func (r DataStoresPage) IsEmpty() (bool, error) { 24 | data, err := ExtractDataStores(r) 25 | if err != nil { 26 | return false, err 27 | } 28 | return len(data.DataStores) == 0, err 29 | } 30 | 31 | 32 | func ExtractDataStores(r pagination.Page) (DataStores, error) { 33 | var s DataStores 34 | err := (r.(DataStoresPage)).ExtractInto(&s) 35 | return s, err 36 | } 37 | -------------------------------------------------------------------------------- /codex_go.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export JAVA_HOME=/root/buildbox/jdk1.8.0_151 4 | export CODEDEX_PATH=/root/buildbox/CodeDEX_V3 5 | export CODEMARS_HOME=$CODEDEX_PATH/tool/tools/codemars_Newest 6 | export GO_HOME=/root/buildbox/go-1.8.1 7 | 8 | #path 9 | export PATH=$GO_HOME/bin:$CODEMARS_HOME/bin:$JAVA_HOME/bin:$PATH 10 | 11 | # FORTIFY_BUILD_ID可设置自己服务的ID值,这个ID名由数字、字母、下划线组成,不支持包含中划线- 12 | export FORTIFY_BUILD_GO=fuxi_codedex_test1 13 | 14 | #使用环境变量INTER_DIR(中间文件目录)、SRC_WS(源码路径)、SCAN_DIR(待扫描的代码相对路径) 15 | export inter_dir=$INTER_DIR 16 | export codemars_tmp_dir=$inter_dir/codemars_tmp 17 | export project_root=$SRC_WS/$SCAN_DIR 18 | 19 | rm -rf $inter_dir 20 | 21 | # codemars 22 | 23 | cd $CODEMARS_HOME 24 | sh CodeMars.sh -go -source $project_root -output $codemars_tmp_dir/CodeMars.json 25 | 26 | cd $codemars_tmp_dir 27 | zip codemars.zip CodeMars.json 28 | cp codemars.zip $inter_dir/ -------------------------------------------------------------------------------- /openstack/blockstorage/v2/extensions/extensions/testing/requests_test.go: -------------------------------------------------------------------------------- 1 | package testing 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/gophercloud/gophercloud/openstack/blockstorage/v2/extensions/extensions" 7 | "github.com/gophercloud/gophercloud/pagination" 8 | th "github.com/gophercloud/gophercloud/testhelper" 9 | "github.com/gophercloud/gophercloud/testhelper/client" 10 | ) 11 | 12 | func TestList(t *testing.T) { 13 | th.SetupHTTP() 14 | defer th.TeardownHTTP() 15 | HandleListExtensionsSuccessfully(t) 16 | 17 | count := 0 18 | 19 | extensions.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { 20 | count++ 21 | actual, err := extensions.ExtractExtensions(page) 22 | th.AssertNoErr(t, err) 23 | th.AssertDeepEquals(t, ExpectedExtensions, actual) 24 | 25 | return true, nil 26 | }) 27 | 28 | th.CheckEquals(t, 1, count) 29 | } 30 | --------------------------------------------------------------------------------