Skip to content

v0.4.0 - Service Packages

Choose a tag to compare

@dannyota dannyota released this 25 Sep 09:17
· 801 commits to master since this release
v0.4.0
396cff2

Breaking changes

  • vngcloud.NewClient and the transitional vngcloud.Client type are gone.
    Every service is now its own top-level package with New(cfg vngcloud.Config) *Client, matching billing and pricing: compute,
    volume, network, loadbalancer, globalloadbalancer, dns,
    containerregistry, portal, and project (new; replaces
    client.ListProjects).
  • NewClient used to log in eagerly, so bad credentials failed before its
    first return. NewConfig does not log in: call cfg.Authenticate(ctx)
    right after it to get that same fail-fast check, or skip it and let the
    first service call log in lazily.
  • Every root re-export of a service type is gone; import the service package
    instead. vngcloud.Server, NetworkInterface, SSHKey, ServerGroup, and
    their List*Options/List*Result types are now compute.*.
    vngcloud.Volume and Zone are volume.*. vngcloud.VPC,
    SecurityGroup, Subnet, RouteTable, and Peering are network.*.
    vngcloud.LoadBalancer, Certificate, Listener, Pool, and Policy are
    loadbalancer.*. vngcloud.GlobalLoadBalancer, GlobalPool, and
    GlobalListener are globalloadbalancer.*. vngcloud.HostedZone,
    RecordValue, and DNSRecord are dns.*. vngcloud.PortalUserInfo,
    PortalZone, PortalQuota, and PortalTagQuota are portal.UserInfo,
    portal.Zone, portal.Quota, and portal.TagQuota.
    vngcloud.ContainerRepository and ContainerRegistryUser are
    containerregistry.Repository and containerregistry.User.
    vngcloud.Project and ListProjectsOptions are project.Project and
    project.ListProjectsInput. Every *Service type (ComputeService,
    VolumeService, NetworkService, LoadBalancerService,
    GlobalLoadBalancerService, DNSService, PortalService,
    ContainerRegistryService) is gone with NewClient; call the package's own
    New(cfg). vngcloud.ListOptions, Page, and ListResult[T] are gone;
    see the paging change below.
  • These root types moved to their package with the same name: compute:
    Flavor, Image, PackageLimit, ServerSecgroup, ServerGroupMember,
    ServerSecurityGroup, ServerGroupMembership, ServerGroupPolicy,
    OSImage, and UserImage. network: WANIP, ElasticNetworkInterface,
    VirtualIPAddress, SubnetSecondarySubnet, SecurityGroupRule,
    RouteTableRoute, Tag, Interconnect, AddressPair, and
    VNetworkRegion. loadbalancer: PoolMember, HealthMonitor, L7Rule,
    and ListenerInsertHeader.
  • Every operation takes one *OpInput and returns one *OpOutput, for
    example compute.New(cfg).GetServer(ctx, &compute.GetServerInput{ServerID: id}). Methods that took bare arguments, such as GetServer(ctx, id) and
    ListSubnets(ctx), moved to Input structs. A required Input field returns
    ErrInvalidInput before any request when it is empty, including a nil
    Input.
  • List outputs name their field: Items for the page, plus Page,
    PageSize, TotalPage, and TotalItem for an API that pages. These sat
    under a nested Page field before, for example res.Page.TotalItem; they
    now sit directly on the result, for example res.TotalItem. A Get returns
    a struct with one named field, such as GetServerOutput{Server Server}.
  • Model renames drop redundant package prefixes now that each service is its
    own package: network renames NetworkRoute to Route, NetworkACL to
    ACL, NetworkEndpoint to Endpoint, NetworkEndpointDetail to
    EndpointDetail (its embedded NetworkEndpoint field is now Endpoint,
    so detail.NetworkEndpoint.Name is now detail.Endpoint.Name), and
    NetworkZone to Zone. loadbalancer renames LoadBalancerNode to
    Node, LoadBalancerPackage to Package, and LoadBalancerTag to Tag;
    its ListLoadBalancerPackages method is renamed to ListPackages, matching
    globalloadbalancer.ListPackages. globalloadbalancer (renamed from the
    glb internal package) renames every GLB- and Global-prefixed type,
    for example GlobalLoadBalancer to LoadBalancer, GLBPackage to
    Package, GLBVLBPackage (vngcloud.GlobalLoadBalancerRegionalPackage)
    to RegionalPackage, and GLBRegion
    (vngcloud.GlobalLoadBalancerRegion) to Region, GlobalLoadBalancerVIP
    to VIP, GlobalLoadBalancerDomain to Domain, GlobalPool to Pool,
    GlobalPoolHealthMonitor to PoolHealthMonitor, GlobalPoolMember to
    PoolMember, GlobalPoolMemberDetail to PoolMemberDetail,
    GlobalListener to Listener, and GlobalLoadBalancerUsageHistory to
    UsageHistory; the root re-export
    vngcloud.GlobalLoadBalancerPackage is now globalloadbalancer.Package.
    dns renames DNSRecord to Record, VpcMapRegion to VPCMapRegion,
    and HostedZone.AssocVpcMapRegion to AssocVPCMapRegion (the
    assocVpcMapRegion JSON key is unchanged). portal renames
    PortalUserInfo, PortalZone, PortalQuota, and PortalTagQuota to
    UserInfo, Zone, Quota, and TagQuota. containerregistry renames
    ContainerRepository to Repository and ContainerRegistryUser to
    User.
  • APIError.Operation is now "<package>.<Method>" in lowercase, such as
    "compute.GetServer", everywhere including project discovery
    ("project.ListProjects").

Highlights

  • network imports compute for compute.Server, since
    ListServersBySecurityGroup returns full server objects.
  • No API coverage changed: every method that existed before keeps its
    behavior under the new signature.